]> git.itanic.dy.fi Git - linux-stable/commitdiff
spi: dln2: Fix reference leak to master
authorWei Yongjun <weiyongjun1@huawei.com>
Fri, 9 Apr 2021 08:29:55 +0000 (08:29 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 9 Apr 2021 12:43:57 +0000 (13:43 +0100)
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>
Link: https://lore.kernel.org/r/20210409082955.2907950-1-weiyongjun1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-dln2.c

index 3902eadb892f9188726f1c35a40c9b5fc961b9f5..3ff63ab82f4fbc2d3cc5cafd20f140efb319eff7 100644 (file)
@@ -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);