[Nouveau] [bug report] drm/nouveau/object: merge with handle

Ben Skeggs skeggsb at gmail.com
Thu May 4 07:31:49 UTC 2017


On 05/04/2017 04:58 PM, Dan Carpenter wrote:
> Hello Ben Skeggs,
Hey Dan,

>
> The patch fbd58ebda9c8: "drm/nouveau/object: merge with handle" from
> Aug 20, 2015, leads to the following static checker warning:
>
> 	drivers/gpu/drm/nouveau/nvkm/core/object.c:298 nvkm_object_ctor()
> 	warn: 'object->engine' is an error pointer or valid
>
> drivers/gpu/drm/nouveau/nvkm/core/object.c
>    283  void
>    284  nvkm_object_ctor(const struct nvkm_object_func *func,
>    285                   const struct nvkm_oclass *oclass, struct nvkm_object *object)
>    286  {
>    287          object->func = func;
>    288          object->client = oclass->client;
>    289          object->engine = nvkm_engine_ref(oclass->engine);
>    290          object->oclass = oclass->base.oclass;
>    291          object->handle = oclass->handle;
>    292          object->route  = oclass->route;
>    293          object->token  = oclass->token;
>    294          object->object = oclass->object;
>    295          INIT_LIST_HEAD(&object->head);
>    296          INIT_LIST_HEAD(&object->tree);
>    297          RB_CLEAR_NODE(&object->node);
>    298          WARN_ON(oclass->engine && !object->engine);
>                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> If oclass->engine is non-NULL then object->engine also can't be NULL.
> It could be an error pointer though so perhaps we intended to check for
> that?  Or it's also possible that we want it as is.
The condition itself should be impossible, but, I've left it in just in 
case and replaced the check with a simple IS_ERR().

Thanks!
Ben.
>
>    299  }
>
> regards,
> dan carpenter
> _______________________________________________
> Nouveau mailing list
> Nouveau at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
>


More information about the Nouveau mailing list