Commit 7c3a46eb authored by Johan Hovold's avatar Johan Hovold Committed by Vinod Koul
Browse files

dmaengine: bcm-sba-raid: fix device leak on probe



Make sure to drop the reference taken when looking up the mailbox device
during probe on probe failures and on driver unbind.

Fixes: 743e1c8f ("dmaengine: Add Broadcom SBA RAID driver")
Cc: stable@vger.kernel.org	# 4.13
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20251117161258.10679-4-johan@kernel.org


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent b9074b2d
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1699,7 +1699,7 @@ static int sba_probe(struct platform_device *pdev)
	/* Prealloc channel resource */
	ret = sba_prealloc_channel_resources(sba);
	if (ret)
		goto fail_free_mchan;
		goto fail_put_mbox;

	/* Check availability of debugfs */
	if (!debugfs_initialized())
@@ -1729,6 +1729,8 @@ static int sba_probe(struct platform_device *pdev)
fail_free_resources:
	debugfs_remove_recursive(sba->root);
	sba_freeup_channel_resources(sba);
fail_put_mbox:
	put_device(sba->mbox_dev);
fail_free_mchan:
	mbox_free_channel(sba->mchan);
	return ret;
@@ -1744,6 +1746,8 @@ static void sba_remove(struct platform_device *pdev)

	sba_freeup_channel_resources(sba);

	put_device(sba->mbox_dev);

	mbox_free_channel(sba->mchan);
}