drm/nouveau/pmu: do not assume a PMU is present
authorAlexandre Courbot <acourbot@nvidia.com>
Thu, 3 Sep 2015 08:39:52 +0000 (17:39 +0900)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 3 Nov 2015 05:02:18 +0000 (15:02 +1000)
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.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c

index 27a79c0c38886522d3b8d1d1df651e4cd054bcd4..d95eb8659d1bdb6279d256b6e90f49d04cff2215 100644 (file)
@@ -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);
 }