drm/nouveau/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.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Alexandre Courbot 2015-09-03 17:39:52 +09:00 committed by Ben Skeggs
parent 04b8a4bd8e
commit 579b7c5821

View file

@ -28,7 +28,7 @@
void void
nvkm_pmu_pgob(struct nvkm_pmu *pmu, bool enable) nvkm_pmu_pgob(struct nvkm_pmu *pmu, bool enable)
{ {
if (pmu->func->pgob) if (pmu && pmu->func->pgob)
pmu->func->pgob(pmu, enable); pmu->func->pgob(pmu, enable);
} }