[PATCH] drm/amdgpu: Fix '*fw' from request_firmware() not released in 'amdgpu_ucode_request()'

Christian König ckoenig.leichtzumerken at gmail.com
Thu Jan 4 08:08:15 UTC 2024



Am 04.01.24 um 04:23 schrieb Srinivasan Shanmugam:
> Fixes the below:
> drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c:1404 amdgpu_ucode_request() warn: '*fw' from request_firmware() not released on lines: 1404.
>
> Cc: Mario Limonciello <mario.limonciello at amd.com>
> Cc: Lijo Lazar <lijo.lazar at amd.com>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> index b14127429f30..b8d000105816 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> @@ -1401,6 +1401,9 @@ int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
>   	if (err)
>   		dev_dbg(adev->dev, "\"%s\" failed to validate\n", fw_name);
>   
> +	release_firmware(*fw);
> +	*fw = NULL;
> +

That doesn't looks even remotely correct. This code path is also taken 
when the validation succeeds.

Christian.

>   	return err;
>   }
>   



More information about the amd-gfx mailing list