[PATCH] drm/drv: propagate errors from drm_modeset_register_all()

Dmitry Baryshkov dmitry.baryshkov at linaro.org
Thu Jul 27 12:41:25 UTC 2023


On 21/05/2023 20:34, Dmitry Baryshkov wrote:
> In case the drm_modeset_register_all() function fails, its error code
> will be ignored. Instead make the drm_dev_register() bail out in case of
> such an error.
> 
> Fixes: 79190ea2658a ("drm: Add callbacks for late registering")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov at linaro.org>

Colleagues, gracious ping.

> ---
>   drivers/gpu/drm/drm_drv.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index c6eb8972451a..dc4a496795ee 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -938,8 +938,11 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
>   			goto err_minors;
>   	}
>   
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> -		drm_modeset_register_all(dev);
> +	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> +		ret = drm_modeset_register_all(dev);
> +		if (ret)
> +			goto err_unload;
> +	}
>   
>   	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
>   		 driver->name, driver->major, driver->minor,
> @@ -949,6 +952,9 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
>   
>   	goto out_unlock;
>   
> +err_unload:
> +	if (dev->driver->unload)
> +		dev->driver->unload(dev);
>   err_minors:
>   	remove_compat_control_link(dev);
>   	drm_minor_unregister(dev, DRM_MINOR_ACCEL);

-- 
With best wishes
Dmitry



More information about the dri-devel mailing list