diff mbox series

[2/3] drm/fb-helper: Check fb_deferred_io_init() return value

Message ID 20230120120822.2536032-3-javierm@redhat.com (mailing list archive)
State Superseded
Headers show
Series Fixes and cleanup for DRM fbdev emulation and deferred I/O | expand

Commit Message

Javier Martinez Canillas Jan. 20, 2023, 12:08 p.m. UTC
The fb_deferred_io_init() can fail and return an errno code but currently
there is no check for its return value.

Fix that and propagate to errno to the caller in the case of a failure.

Fixes: d536540f304c ("drm/fb-helper: Add generic fbdev emulation .fb_probe function")
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---

 drivers/gpu/drm/drm_fbdev_generic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Thomas Zimmermann Jan. 20, 2023, 12:20 p.m. UTC | #1
Am 20.01.23 um 13:08 schrieb Javier Martinez Canillas:
> The fb_deferred_io_init() can fail and return an errno code but currently
> there is no check for its return value.
> 
> Fix that and propagate to errno to the caller in the case of a failure.
> 
> Fixes: d536540f304c ("drm/fb-helper: Add generic fbdev emulation .fb_probe function")
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>

The error cleanup in this function is already broken; just returning is 
good enough for now.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
> 
>   drivers/gpu/drm/drm_fbdev_generic.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
> index 0a4c160e0e58..b2df8c03594c 100644
> --- a/drivers/gpu/drm/drm_fbdev_generic.c
> +++ b/drivers/gpu/drm/drm_fbdev_generic.c
> @@ -223,7 +223,9 @@ static int drm_fbdev_fb_probe(struct drm_fb_helper *fb_helper,
>   		fbi->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
>   
>   		fbi->fbdefio = &drm_fbdev_defio;
> -		fb_deferred_io_init(fbi);
> +		ret = fb_deferred_io_init(fbi);
> +		if (ret)
> +			return ret;
>   	} else {
>   		/* buffer is mapped for HW framebuffer */
>   		ret = drm_client_buffer_vmap(fb_helper->buffer, &map);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
index 0a4c160e0e58..b2df8c03594c 100644
--- a/drivers/gpu/drm/drm_fbdev_generic.c
+++ b/drivers/gpu/drm/drm_fbdev_generic.c
@@ -223,7 +223,9 @@  static int drm_fbdev_fb_probe(struct drm_fb_helper *fb_helper,
 		fbi->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
 
 		fbi->fbdefio = &drm_fbdev_defio;
-		fb_deferred_io_init(fbi);
+		ret = fb_deferred_io_init(fbi);
+		if (ret)
+			return ret;
 	} else {
 		/* buffer is mapped for HW framebuffer */
 		ret = drm_client_buffer_vmap(fb_helper->buffer, &map);