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

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2018-06-15 07:59:28 +10:00
Родитель f0fffeeb14
Коммит f7fbbf2cca
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -87,11 +87,12 @@ nvkm_engine_info(struct nvkm_subdev *subdev, u64 mthd, u64 *data)
{
struct nvkm_engine *engine = nvkm_engine(subdev);
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);
nvkm_engine_unref(&engine);
return ret;
}
return PTR_ERR(engine);
}
return -ENOSYS;
}