drm/amdgpu: Avoid to release the FW twice in the validated error
Subsystems (2)
PATCH 1/1 drm/amdgpu: Avoid to release the FW twice in the validated error
There will to release the FW twice when the FW validated error. Even if the release_firmware() will further validate the FW whether is empty, but that will be redundant and inefficient.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +1 -4
@@ -1461,11 +1461,8 @@ int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,return -ENODEV ; r =amdgpu_ucode_validate (*fw); -if (r) { +if (r)dev_dbg (adev->dev,"\"%s\" failed to validate\n" , fname); -release_firmware (*fw); - *fw =NULL ; - }return r; }
Signature · 1 line
2.34.1
Quoted 3 lines · Prike Liang
There will to release the FW twice when the FW validated error. Even if the
release_firmware()will further validate the FW whether is empty, but that will be redundant and inefficient.
Better to add a remark that amdgpu_ucode_request should be paired with amdgpu_ucode_release regardless of success/failure. amdgpu_ucode_release takes care of firmware release, avoiding redundant operation here.
Thanks,
Lijo
Quoted 23 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +1
-4@@ -1461,11 +1461,8 @@ int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,return -ENODEV ; r =amdgpu_ucode_validate (*fw); -if (r) { +if (r)dev_dbg (adev->dev,"\"%s\" failed to validate\n" , fname); -release_firmware (*fw); - *fw =NULL ; - }return r; }
[AMD Official Use Only - AMD Internal Distribution Only]
Thanks for the input, as offline syncing will add this remark in the function amdgpu_ucode_request() description part.
Regards,
Prike
Quoted 50 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, December 2, 2024 3:46 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Avoid to release the FW twice in the validated errorQuoted 3 lines · Prike Liang
There will to release the FW twice when the FW validated error. Even if the
release_firmware()will further validate the FW whether is empty, but that will be redundant and inefficient.Better to add a remark that
amdgpu_ucode_requestshould be paired withamdgpu_ucode_releaseregardless of success/failure.amdgpu_ucode_releasetakes care of firmware release, avoiding redundant operation here.Reviewed-by Lijo Lazar <[email protected]>Thanks,
Lijodrivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c int amdgpu_ucode_request(struct amdgpu_device
Quoted 12 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +0
-0@@ -1461,11 +1461,8 @@ int amdgpu_ucode_request(struct amdgpu_device*adev, const struct firmware **fw,
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +1
-4return -ENODEV ; r =amdgpu_ucode_validate (*fw); -if (r) { +if (r)dev_dbg (adev->dev,"\"%s\" failed to validate\n" , fname); -release_firmware (*fw); - *fw =NULL ; - }return r; }