dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: Fix return value of drm_framebuffer_init()
@ 2015-10-15  9:56 Lukas Wunner
  2015-10-15 13:34 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wunner @ 2015-10-15  9:56 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

In its original version, drm_framebuffer_init() returned a negative int
if drm_mode_object_get() failed (f453ba046074, "DRM: add mode setting
support").

This was accidentally disabled by commit 4b096ac10da0 ("drm: revamp
locking around fb creation/destruction"). Thus, drm_framebuffer_init()
pretends success if drm_mode_object_get() failed.

Reinstate the original behaviour. Also fix erroneous kernel-doc of
drm_mode_object_get().

Fixes: 4b096ac10da0 ("drm: revamp locking around fb creation/
    destruction")
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/gpu/drm/drm_crtc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index e600a5f..7a9ae78 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -306,8 +306,7 @@ static int drm_mode_object_get_reg(struct drm_device *dev,
  * reference counted modeset objects like framebuffers.
  *
  * Returns:
- * New unique (relative to other objects in @dev) integer identifier for the
- * object.
+ * Zero on success, error code on failure.
  */
 int drm_mode_object_get(struct drm_device *dev,
 			struct drm_mode_object *obj, uint32_t obj_type)
@@ -423,7 +422,7 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb,
 out:
 	mutex_unlock(&dev->mode_config.fb_lock);
 
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL(drm_framebuffer_init);
 
-- 
1.8.5.2 (Apple Git-48)

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm: Fix return value of drm_framebuffer_init()
  2015-10-15  9:56 [PATCH] drm: Fix return value of drm_framebuffer_init() Lukas Wunner
@ 2015-10-15 13:34 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2015-10-15 13:34 UTC (permalink / raw)
  To: Lukas Wunner; +Cc: Daniel Vetter, dri-devel

On Thu, Oct 15, 2015 at 11:56:56AM +0200, Lukas Wunner wrote:
> In its original version, drm_framebuffer_init() returned a negative int
> if drm_mode_object_get() failed (f453ba046074, "DRM: add mode setting
> support").
> 
> This was accidentally disabled by commit 4b096ac10da0 ("drm: revamp
> locking around fb creation/destruction"). Thus, drm_framebuffer_init()
> pretends success if drm_mode_object_get() failed.
> 
> Reinstate the original behaviour. Also fix erroneous kernel-doc of
> drm_mode_object_get().
> 
> Fixes: 4b096ac10da0 ("drm: revamp locking around fb creation/
>     destruction")
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Lukas Wunner <lukas@wunner.de>

Nice catch. Applied to drm-misc, thanks.
-Daniel

> ---
>  drivers/gpu/drm/drm_crtc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index e600a5f..7a9ae78 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -306,8 +306,7 @@ static int drm_mode_object_get_reg(struct drm_device *dev,
>   * reference counted modeset objects like framebuffers.
>   *
>   * Returns:
> - * New unique (relative to other objects in @dev) integer identifier for the
> - * object.
> + * Zero on success, error code on failure.
>   */
>  int drm_mode_object_get(struct drm_device *dev,
>  			struct drm_mode_object *obj, uint32_t obj_type)
> @@ -423,7 +422,7 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb,
>  out:
>  	mutex_unlock(&dev->mode_config.fb_lock);
>  
> -	return 0;
> +	return ret;
>  }
>  EXPORT_SYMBOL(drm_framebuffer_init);
>  
> -- 
> 1.8.5.2 (Apple Git-48)
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2015-10-15 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15  9:56 [PATCH] drm: Fix return value of drm_framebuffer_init() Lukas Wunner
2015-10-15 13:34 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox