bus: hisi_lpc: fix missing platform_device_put() in hisi_lpc_acpi_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 1 Jul 2022 09:43:52 +0000 (17:43 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:10 +0000 (14:23 +0200)
commit4a020202c39113a3a8d513fbb140c71376069433
tree8e63ae81316389a00b020392780ba3470e6f0faf
parenta0a9813f1e094fb007c3bfcb167917d82c3f4d79
bus: hisi_lpc: fix missing platform_device_put() in hisi_lpc_acpi_probe()

[ Upstream commit 54872fea6a5ac967ec2272aea525d1438ac6735a ]

In error case in hisi_lpc_acpi_probe() after calling platform_device_add(),
hisi_lpc_acpi_remove() can't release the failed 'pdev', so it will be leak,
call platform_device_put() to fix this problem.
I'v constructed this error case and tested this patch on D05 board.

Fixes: 99c0228d6ff1 ("HISI LPC: Re-Add ACPI child enumeration support")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/bus/hisi_lpc.c