[bug report] drm: re-enable error handling

Nicholas Mc Guire der.herr at hofr.at
Thu Jul 19 08:22:21 UTC 2018


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


More information about the dri-devel mailing list