dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/drv: propagate errors from drm_modeset_register_all()
@ 2023-05-21 17:34 Dmitry Baryshkov
  2023-07-27 12:41 ` Dmitry Baryshkov
  2023-10-06  7:25 ` Neil Armstrong
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2023-05-21 17:34 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter
  Cc: freedreno, Abhinav Kumar, dri-devel

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@linaro.org>
---
 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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/drv: propagate errors from drm_modeset_register_all()
  2023-05-21 17:34 [PATCH] drm/drv: propagate errors from drm_modeset_register_all() Dmitry Baryshkov
@ 2023-07-27 12:41 ` Dmitry Baryshkov
  2023-10-06  7:25 ` Neil Armstrong
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2023-07-27 12:41 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter
  Cc: freedreno, Abhinav Kumar, dri-devel

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@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/drv: propagate errors from drm_modeset_register_all()
  2023-05-21 17:34 [PATCH] drm/drv: propagate errors from drm_modeset_register_all() Dmitry Baryshkov
  2023-07-27 12:41 ` Dmitry Baryshkov
@ 2023-10-06  7:25 ` Neil Armstrong
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Armstrong @ 2023-10-06  7:25 UTC (permalink / raw)
  To: Dmitry Baryshkov, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Daniel Vetter
  Cc: freedreno, Abhinav Kumar, dri-devel

On 21/05/2023 19: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@linaro.org>
> ---
>   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);

Looks sane to report this error:
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-06  7:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-21 17:34 [PATCH] drm/drv: propagate errors from drm_modeset_register_all() Dmitry Baryshkov
2023-07-27 12:41 ` Dmitry Baryshkov
2023-10-06  7:25 ` Neil Armstrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).