drm/nouveau/pm: prevent creating a perfctr object when signals are not found
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sun, 7 Jun 2015 20:40:16 +0000 (22:40 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 28 Aug 2015 02:39:58 +0000 (12:39 +1000)
Since a new class has been introduced to query signals, we can now
return an error when the userspace wants to monitor unknown signals.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c

index cb88170610bbb4c70f48373efb5a16176a627d8f..2f851473cecfd1d107dcfa4d6ef8980b20eee976 100644 (file)
@@ -294,6 +294,9 @@ nvkm_perfctr_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
                        return -EINVAL;
        }
 
+       if (!dom)
+               return -EINVAL;
+
        ret = nvkm_object_create(parent, engine, oclass, 0, &ctr);
        *pobject = nv_object(ctr);
        if (ret)
@@ -305,8 +308,7 @@ nvkm_perfctr_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
        ctr->signal[1] = sig[1];
        ctr->signal[2] = sig[2];
        ctr->signal[3] = sig[3];
-       if (dom)
-               list_add_tail(&ctr->head, &dom->list);
+       list_add_tail(&ctr->head, &dom->list);
        return 0;
 }