mmc: sdhci-pci: Fix possible memory leak caused by missing pci_dev_put()
authorXiongfeng Wang <wangxiongfeng2@huawei.com>
Mon, 14 Nov 2022 08:31:00 +0000 (16:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Nov 2022 08:24:48 +0000 (09:24 +0100)
commita99a547658e5d451f01ed307426286716b6f01bf
tree56ea88835c3866f0185ad6b6687939dbdfd171ef
parent4a1b6f7839d3571d37ce344abdf60283298f6c83
mmc: sdhci-pci: Fix possible memory leak caused by missing pci_dev_put()

commit 222cfa0118aa68687ace74aab8fdf77ce8fbd7e6 upstream.

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: 659c9bc114a8 ("mmc: sdhci-pci: Build o2micro support in the same module")
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20221114083100.149200-1-wangxiongfeng2@huawei.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/host/sdhci-pci-core.c