Skip to content

Commit 222cfa0

Browse files
fenghusthustorulf
authored andcommitted
mmc: sdhci-pci: Fix possible memory leak caused by missing pci_dev_put()
pci_get_device() will increase the reference count for the returned pci_dev. We need to use pci_dev_put() to decrease the reference count before amd_probe() returns. There is no problem for the 'smbus_dev == NULL' branch because pci_dev_put() can also handle the NULL input parameter case. Fixes: 659c9bc ("mmc: sdhci-pci: Build o2micro support in the same module") Signed-off-by: Xiongfeng Wang <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 096cc0c commit 222cfa0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/mmc/host/sdhci-pci-core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,8 @@ static int amd_probe(struct sdhci_pci_chip *chip)
17491749
}
17501750
}
17511751

1752+
pci_dev_put(smbus_dev);
1753+
17521754
if (gen == AMD_CHIPSET_BEFORE_ML || gen == AMD_CHIPSET_CZ)
17531755
chip->quirks2 |= SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD;
17541756

0 commit comments

Comments
 (0)