video: tegra: gk20a: Avoid crash on teardown
Robert Morell [Tue, 9 Apr 2013 20:15:18 +0000 (13:15 -0700)]
If PMU failed to initialize for any reason, we still try to call its
"remove_support" function pointer, which is NULL.

Bug 1268414

Change-Id: I90b96104a44e441ae07625066f9c1d698556e695
Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-on: http://git-master/r/217935
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jin Qian <jqian@nvidia.com>
Reviewed-by: Ken Adams <kadams@nvidia.com>

drivers/video/tegra/host/gk20a/pmu_gk20a.c

index d2be325..ecc7620 100644 (file)
@@ -2443,7 +2443,10 @@ int gk20a_pmu_destroy(struct gk20a *g)
 
        pmu_enable_hw(pmu, false);
 
-       pmu->remove_support(pmu);
+       if (pmu->remove_support) {
+               pmu->remove_support(pmu);
+               pmu->remove_support = NULL;
+       }
 
        nvhost_dbg_fn("done");
        return 0;