[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 > -----Original Message----- > From: Lazar, Lijo <Lijo.Lazar@xxxxxxx> > Sent: Monday, December 2, 2024 3:46 PM > To: Liang, Prike <Prike.Liang@xxxxxxx>; amd-gfx@xxxxxxxxxxxxxxxxxxxxx > Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx>; Koenig, Christian > <Christian.Koenig@xxxxxxx> > Subject: Re: [PATCH] drm/amdgpu: Avoid to release the FW twice in the validated > error > > > > On 12/2/2024 12:16 PM, Prike Liang wrote: > > 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. > > Reviewed-by: Lijo Lazar <lijo.lazar@xxxxxxx> > > Thanks, > Lijo > > > > > Signed-off-by: Prike Liang <Prike.Liang@xxxxxxx> > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 5 +---- > > 1 file changed, 1 insertion(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c > > index 4c7b53648a50..e7f50415926c 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c > > @@ -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; > > }