Skip to contentSkip to conversation

pmu: do not assume a PMU is present

PATCH New Alexandre Courbot 1 participant 1 message Sep 3, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 pmu: do not assume a PMU is present

Some devices may not have a PMU. Avoid a NULL pointer dereference in such cases by checking whether the pointer given to nvkm_pmu_pgob() is valid.

---
 drm/nouveau/nvkm/subdev/pmu/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drm/nouveau/nvkm/subdev/pmu/base.c +1 -1
index 27a79c0c3888..d95eb8659d1b 100644
@@ -28,7 +28,7 @@
 void
 nvkm_pmu_pgob(struct nvkm_pmu *pmu, bool enable)
 {
-	if (pmu->func->pgob)
+	if (pmu && pmu->func->pgob)
 		pmu->func->pgob(pmu, enable);
 }
 
Signature · 6 lines
2.5.1

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau