[PATCH 2/2] drm/amdgpu: add fw release for sdma v5_0
Christian König
ckoenig.leichtzumerken at gmail.com
Mon Jun 22 18:20:20 UTC 2020
Am 18.06.20 um 09:53 schrieb Wenhui Sheng:
> sdma v5_0 fw isn't released when module exit
>
> Signed-off-by: Wenhui Sheng <Wenhui.Sheng at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
> index 58d2a80af450..6751ad69ed90 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
> @@ -1299,8 +1299,12 @@ static int sdma_v5_0_sw_fini(void *handle)
> struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> int i;
>
> - for (i = 0; i < adev->sdma.num_instances; i++)
> + for (i = 0; i < adev->sdma.num_instances; i++) {
> + if (adev->sdma.instance[i].fw != NULL)
> + release_firmware(adev->sdma.instance[i].fw);
Please drop the extra NULL check here.
Kernel APIs like kfree() etc.. are usually NULL tolerant and we have
automated scripts complaining about this as bad coding style if you
duplicate the check in the driver.
Apart from that the series looks good to me.
Regards,
Christian.
> +
> amdgpu_ring_fini(&adev->sdma.instance[i].ring);
> + }
>
> return 0;
> }
More information about the amd-gfx
mailing list