Commit f7fbbf2c authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/core: ERR_PTR vs NULL bug in nvkm_engine_info()

Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent f0fffeeb
...@@ -87,11 +87,12 @@ nvkm_engine_info(struct nvkm_subdev *subdev, u64 mthd, u64 *data) ...@@ -87,11 +87,12 @@ nvkm_engine_info(struct nvkm_subdev *subdev, u64 mthd, u64 *data)
{ {
struct nvkm_engine *engine = nvkm_engine(subdev); struct nvkm_engine *engine = nvkm_engine(subdev);
if (engine->func->info) { if (engine->func->info) {
if ((engine = nvkm_engine_ref(engine))) { if (!IS_ERR((engine = nvkm_engine_ref(engine)))) {
int ret = engine->func->info(engine, mthd, data); int ret = engine->func->info(engine, mthd, data);
nvkm_engine_unref(&engine); nvkm_engine_unref(&engine);
return ret; return ret;
} }
return PTR_ERR(engine);
} }
return -ENOSYS; return -ENOSYS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment