[PATCH] drm/amd/amdgpu: handle return value of amdgpu_driver_load_kms

Nirmoy nirmodas at amd.com
Tue Jun 9 10:02:24 UTC 2020


Acked-by: Nirmoy Das <nirmoy.das at amd.com>

On 6/9/20 11:20 AM, Liu ChengZhe wrote:
> if guest driver failed to enter full GPU access, amdgpu_driver_load_kms
> will unload kms and free dev->dev_private, drm_dev_register would access
> null pointer. Driver will enter an error state and can't be unloaded.
>
> Signed-off-by: Liu ChengZhe <ChengZhe.Liu at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 667aad1f15c0..9c81a3d0b546 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1165,7 +1165,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
>   
>   	pci_set_drvdata(pdev, dev);
>   
> -	amdgpu_driver_load_kms(dev, ent->driver_data);
> +	ret = amdgpu_driver_load_kms(dev, ent->driver_data);
> +	if (ret)
> +		goto err_pci;
>   
>   retry_init:
>   	ret = drm_dev_register(dev, ent->driver_data);


More information about the amd-gfx mailing list