]> git.hungrycats.org Git - linux/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Feb 2016 22:28:38 +0000 (14:28 -0800)
commit 579b7c58215329803ce184704463de09f0f310ac upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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);
 }