drm/nouveau/pmu: make sure the reset hook exists before running it
authorAlexandre Courbot <acourbot@nvidia.com>
Thu, 17 Nov 2016 07:37:29 +0000 (16:37 +0900)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 7 Mar 2017 07:05:11 +0000 (17:05 +1000)
Some PMU implementations (in particular the ones managed by secure
boot) may not have a reset() hook. Make sure we don't crash in that
case.

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 a73f690eb4b576d88302d6c096de05870677dc22..ad4ac4e8b29e11cdb1bf8d5273862228c0ca2f18 100644 (file)
@@ -85,7 +85,8 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu)
        );
 
        /* Reset. */
-       pmu->func->reset(pmu);
+       if (pmu->func->reset)
+               pmu->func->reset(pmu);
 
        /* Wait for IMEM/DMEM scrubbing to be complete. */
        nvkm_msec(device, 2000,