diff mbox series

[-next] spi: dln2: Fix reference leak to master

Message ID 20210409082955.2907950-1-weiyongjun1@huawei.com (mailing list archive)
State Accepted
Commit 9b844b087124c1538d05f40fda8a4fec75af55be
Headers show
Series [-next] spi: dln2: Fix reference leak to master | expand

Commit Message

Wei Yongjun April 9, 2021, 8:29 a.m. UTC
Call spi_master_get() holds the reference count to master device, thus
we need an additional spi_master_put() call to reduce the reference
count, otherwise we will leak a reference to master.

This commit fix it by removing the unnecessary spi_master_get().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/spi/spi-dln2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown April 9, 2021, 4:22 p.m. UTC | #1
On Fri, 9 Apr 2021 08:29:55 +0000, Wei Yongjun wrote:
> Call spi_master_get() holds the reference count to master device, thus
> we need an additional spi_master_put() call to reduce the reference
> count, otherwise we will leak a reference to master.
> 
> This commit fix it by removing the unnecessary spi_master_get().

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: dln2: Fix reference leak to master
      commit: 9b844b087124c1538d05f40fda8a4fec75af55be

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/spi/spi-dln2.c b/drivers/spi/spi-dln2.c
index 3902eadb892f..3ff63ab82f4f 100644
--- a/drivers/spi/spi-dln2.c
+++ b/drivers/spi/spi-dln2.c
@@ -781,7 +781,7 @@  static int dln2_spi_probe(struct platform_device *pdev)
 
 static int dln2_spi_remove(struct platform_device *pdev)
 {
-	struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
+	struct spi_master *master = platform_get_drvdata(pdev);
 	struct dln2_spi *dln2 = spi_master_get_devdata(master);
 
 	pm_runtime_disable(&pdev->dev);