[PATCH] drm/amdgpu: add some error hanbdling to amdgpu_init

Deucher, Alexander Alexander.Deucher at amd.com
Fri Oct 28 16:37:28 UTC 2016


> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Christian König
> Sent: Friday, October 28, 2016 11:40 AM
> To: amd-gfx at lists.freedesktop.org
> Subject: [PATCH] drm/amdgpu: add some error hanbdling to amdgpu_init
> 
> From: Christian König <christian.koenig at amd.com>
> 
> Just to be clean should we ever run into -ENOMEM during module init.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 26
> +++++++++++++++++++++++---
>  1 file changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 7224d17..eb418a0 100755
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -746,9 +746,20 @@ static struct pci_driver amdgpu_kms_pci_driver = {
> 
>  static int __init amdgpu_init(void)
>  {
> -	amdgpu_sync_init();
> -	amdgpu_fence_slab_init();
> -	amd_sched_fence_slab_init();
> +	int r;
> +
> +	r = amdgpu_sync_init();
> +	if (r)
> +		goto error_sync;
> +
> +	r = amdgpu_fence_slab_init();
> +	if (r)
> +		goto error_fence;
> +
> +	r = amd_sched_fence_slab_init();
> +	if (r)
> +		goto error_sched;
> +
>  	if (vgacon_text_force()) {
>  		DRM_ERROR("VGACON disables amdgpu kernel
> modesetting.\n");
>  		return -EINVAL;
> @@ -760,6 +771,15 @@ static int __init amdgpu_init(void)
>  	amdgpu_register_atpx_handler();
>  	/* let modprobe override vga console setting */
>  	return drm_pci_init(driver, pdriver);
> +
> +error_sched:
> +	amdgpu_fence_slab_fini();
> +
> +error_fence:
> +	amdgpu_sync_fini();
> +
> +error_sync:
> +	return r;
>  }
> 
>  static void __exit amdgpu_exit(void)
> --
> 2.5.0
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list