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; > }