AMD General
> -----Original Message-----
> From: Sun, Ce(Overlord) <[email protected]>
> Sent: Monday, June 22, 2026 11:17 PM
> To: [email protected]
> Cc: Zhang, Hawking <[email protected]>; Chai, Thomas
> <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley
> <[email protected]>; Sun, Ce(Overlord) <[email protected]>
> Subject: [PATCH 2/2] drm/amdgpu: fix resource leak on ACP reset timeout
>
> When ACP soft reset poll times out, original code returns early without
> cleanup, leaking MFD child devices, genpd links and all ACP heap allocations.
>
> Replace direct early return with goto out to force run all cleanup logic
> regardless of reset success, preserve timeout error code for caller.
>
> Signed-off-by: Ce Sun <[email protected]>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
> index b0db0834bfff..1bb931d1d2c9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
> @@ -510,6 +510,7 @@ static int acp_hw_fini(struct amdgpu_ip_block
> *ip_block)
> u32 val = 0;
> u32 count = 0;
> struct amdgpu_device *adev = ip_block->adev;
> + int ret = 0;
[Tao] where's return ret?
>
> /* return early if no ACP */
> if (!adev->acp.acp_genpd) {
> @@ -531,7 +532,8 @@ static int acp_hw_fini(struct amdgpu_ip_block
> *ip_block)
> break;
> if (--count == 0) {
> dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
> - return -ETIMEDOUT;
> + ret = -ETIMEDOUT;
> + goto out;
> }
> udelay(100);
> }
> @@ -552,7 +554,7 @@ static int acp_hw_fini(struct amdgpu_ip_block
> *ip_block)
> }
> udelay(100);
> }
> -
> +out:
> device_for_each_child(adev->acp.parent, NULL,
> acp_genpd_remove_device);
>
> --
> 2.34.1