dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [bug report] drm: re-enable error handling
@ 2018-07-19  8:10 Dan Carpenter
  2018-07-19  8:22 ` Nicholas Mc Guire
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-07-19  8:10 UTC (permalink / raw)
  To: hofrat; +Cc: dri-devel

Hello Nicholas Mc Guire,

The patch d530b5f1ca0b: "drm: re-enable error handling" from Jul 14,
2018, leads to the following static checker warning:

	drivers/gpu/drm/drm_context.c:375 drm_legacy_addctx()
	warn: unsigned 'ctx->handle' is never less than zero.

drivers/gpu/drm/drm_context.c
   359  int drm_legacy_addctx(struct drm_device *dev, void *data,
   360                        struct drm_file *file_priv)
   361  {
   362          struct drm_ctx_list *ctx_entry;
   363          struct drm_ctx *ctx = data;
   364  
   365          if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
   366              !drm_core_check_feature(dev, DRIVER_LEGACY))
   367                  return -EINVAL;
   368  
   369          ctx->handle = drm_legacy_ctxbitmap_next(dev);
   370          if (ctx->handle == DRM_KERNEL_CONTEXT) {
   371                  /* Skip kernel's context and get a new one. */
   372                  ctx->handle = drm_legacy_ctxbitmap_next(dev);
   373          }
   374          DRM_DEBUG("%d\n", ctx->handle);
   375          if (ctx->handle < 0) {
                    ^^^^^^^^^^^^^^^
This can't be true.

   376                  DRM_DEBUG("Not enough free contexts.\n");
   377                  /* Should this return -EBUSY instead? */
   378                  return -ENOMEM;
   379          }

regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [bug report] drm: re-enable error handling
  2018-07-19  8:10 [bug report] drm: re-enable error handling Dan Carpenter
@ 2018-07-19  8:22 ` Nicholas Mc Guire
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas Mc Guire @ 2018-07-19  8:22 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: dri-devel, hofrat

On Thu, Jul 19, 2018 at 11:10:30AM +0300, Dan Carpenter wrote:
> Hello Nicholas Mc Guire,
> 
> The patch d530b5f1ca0b: "drm: re-enable error handling" from Jul 14,
> 2018, leads to the following static checker warning:
> 
> 	drivers/gpu/drm/drm_context.c:375 drm_legacy_addctx()
> 	warn: unsigned 'ctx->handle' is never less than zero.
> 
> drivers/gpu/drm/drm_context.c
>    359  int drm_legacy_addctx(struct drm_device *dev, void *data,
>    360                        struct drm_file *file_priv)
>    361  {
>    362          struct drm_ctx_list *ctx_entry;
>    363          struct drm_ctx *ctx = data;
>    364  
>    365          if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>    366              !drm_core_check_feature(dev, DRIVER_LEGACY))
>    367                  return -EINVAL;
>    368  
>    369          ctx->handle = drm_legacy_ctxbitmap_next(dev);
>    370          if (ctx->handle == DRM_KERNEL_CONTEXT) {
>    371                  /* Skip kernel's context and get a new one. */
>    372                  ctx->handle = drm_legacy_ctxbitmap_next(dev);
>    373          }
>    374          DRM_DEBUG("%d\n", ctx->handle);
>    375          if (ctx->handle < 0) {
>                     ^^^^^^^^^^^^^^^
> This can't be true.

yup this was also reported by kbuild test robot <lkp@intel.com> and
(hopfully correctly) fixed in [PATCH V3] drm: handle error values properly
see http://lkml.org/lkml/2018/7/18/191

thx!
hofrat

> 
>    376                  DRM_DEBUG("Not enough free contexts.\n");
>    377                  /* Should this return -EBUSY instead? */
>    378                  return -ENOMEM;
>    379          }
> 
> regards,
> dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-07-19  8:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-19  8:10 [bug report] drm: re-enable error handling Dan Carpenter
2018-07-19  8:22 ` Nicholas Mc Guire

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).