[PATCH] drm/amdgpu: unmap register bar on device init failure

Andrey Grodzovsky Andrey.Grodzovsky at amd.com
Wed Sep 16 14:38:56 UTC 2020


Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>

Andrey

On 9/16/20 10:33 AM, Alex Deucher wrote:
> We never unmapped the regiser BAR on failure.
>
> Reported-by: kernel test robot <lkp at intel.com>
> Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index d633e5448476..61ba5eba678a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3209,13 +3209,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,
>   	r = amdgpu_device_get_job_timeout_settings(adev);
>   	if (r) {
>   		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
> -		return r;
> +		goto failed_unmap;
>   	}
>   
>   	/* early init functions */
>   	r = amdgpu_device_ip_early_init(adev);
>   	if (r)
> -		return r;
> +		goto failed_unmap;
>   
>   	/* doorbell bar mapping and doorbell index init*/
>   	amdgpu_device_doorbell_init(adev);
> @@ -3421,6 +3421,10 @@ int amdgpu_device_init(struct amdgpu_device *adev,
>   	if (boco)
>   		vga_switcheroo_fini_domain_pm_ops(adev->dev);
>   
> +failed_unmap:
> +	iounmap(adev->rmmio);
> +	adev->rmmio = NULL;
> +
>   	return r;
>   }
>   


More information about the amd-gfx mailing list