Re: [PATCH v2] bus: hisi_lpc: fix missing platform_device_put() in hisi_lpc_acpi_probe()

From: John Garry
Date: Mon Jul 04 2022 - 05:40:27 EST


On 04/07/2022 10:34, Yang Yingliang wrote:
In error case in hisi_lpc_acpi_probe() after calling platform_device_alloc(),
if platform_device_add() is not called successfully, hisi_lpc_acpi_remove()
can't release the failed 'pdev' including its resource and data, so they will
be leaked, call platform_device_put() to put the refcount, then they will be
freed in platform_device_release().
I'v constructed this error case and tested this patch on D05 board.

/s/I'v/I've/


Fixes: 99c0228d6ff1 ("HISI LPC: Re-Add ACPI child enumeration support")
Reported-by: Hulk Robot<hulkci@xxxxxxxxxx>
Signed-off-by: Yang Yingliang<yangyingliang@xxxxxxxxxx>

Reviewed-by: John Garry <john.garry@xxxxxxxxxx>