summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2015-06-07 22:40:16 +0200
committerBen Skeggs <bskeggs@redhat.com>2015-08-28 12:37:23 +1000
commit98c55d220b4232e7f3a3173503cf67af17df3fdc (patch)
treeedd20d16eb40121dc811312bffa1e9b0e6808a0f
parent9fc5ec6a488621e7f700725b7ef659eecb6d8224 (diff)
pm: prevent creating a perfctr object when signals are not found
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>
-rw-r--r--drm/nouveau/nvkm/engine/pm/base.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drm/nouveau/nvkm/engine/pm/base.c b/drm/nouveau/nvkm/engine/pm/base.c
index cb881706..2f851473 100644
--- a/drm/nouveau/nvkm/engine/pm/base.c
+++ b/drm/nouveau/nvkm/engine/pm/base.c
@@ -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;
}