[PATCH] drm/amdgpu: Release 'adev->pm.fw' before return in 'amdgpu_device_need_post()'

SRINIVASAN SHANMUGAM srinivasan.shanmugam at amd.com
Thu Dec 21 12:57:26 UTC 2023


Sorry, there seems to be a problem in the logic, will resend v2 onto this.

On 12/21/2023 6:15 PM, Srinivasan Shanmugam wrote:
> In function 'amdgpu_device_need_post(struct amdgpu_device *adev)' -
> 'adev->pm.fw' may not be released before return.
>
> Using the function release_firmware() to release adev->pm.fw.
>
> Thus fixing the below:
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1571 amdgpu_device_need_post() warn: 'adev->pm.fw' from request_firmware() not released on lines: 1554.
>
> Cc: Monk Liu <Monk.Liu 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_device.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 4b694696930e..669e6261b707 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1544,6 +1544,9 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev)
>   				return true;
>   
>   			fw_ver = *((uint32_t *)adev->pm.fw->data + 69);
> +
> +			release_firmware(adev->pm.fw);
> +
>   			if (fw_ver < 0x00160e00)
>   				return true;
>   		}


More information about the amd-gfx mailing list