]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
spi: dln2: Fix reference leak to master
authorWei Yongjun <weiyongjun1@huawei.com>
Fri, 9 Apr 2021 08:29:55 +0000 (08:29 +0000)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 19 May 2021 08:32:02 +0000 (10:32 +0200)
BugLink: https://bugs.launchpad.net/bugs/1928857
[ Upstream commit 9b844b087124c1538d05f40fda8a4fec75af55be ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/spi/spi-dln2.c

index 75b33d7d14b0460c2540e2a69506eda2dc39091c..9a4d942fafcf5070f00c7ebfcf85fc4003e0213d 100644 (file)
@@ -780,7 +780,7 @@ exit_free_master:
 
 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);