drm/nouveau/object: merge with handle
Hello Ben Skeggs,
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.
299 }
regards,
dan carpenter
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Quoted 1 line · Dan Carpenter
Hello Ben Skeggs,
Hey Dan,
Quoted 25 lines
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 structnvkm_object_func*func,
285 const structnvkm_oclass*oclass, structnvkm_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); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quoted 3 lines
If
oclass->engineis non-NULL thenobject->enginealso 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.
Quoted 10 lines
299 }regards,
dan carpenter
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau