drm/nouveau: Make clock gate support conditional

"Linux Kernel Mailing List" <[email protected]> Fri, 16 Feb 2018 17:15:05 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/92256269893e96e5f9e8ac6dd882a0bef63fcea7
Commit:     92256269893e96e5f9e8ac6dd882a0bef63fcea7
Parent:     b515483e12b81da8cb62f1ff2461d6c29cf5115f
Refname:    refs/heads/master
Author:     Thierry Reding <[email protected]>
AuthorDate: Wed Feb 7 18:40:27 2018 +0100
Committer:  Ben Skeggs <[email protected]>
CommitDate: Fri Feb 16 14:07:58 2018 +1000

    drm/nouveau: Make clock gate support conditional
    
    The recently introduced clock gate support breaks on Tegra chips because
    no thermal support is enabled for those devices. Conditionalize the code
    on the existence of thermal support to fix this.
    
    Fixes: b138eca661cc ("drm/nouveau: Add support for basic clockgating on Kepler1")
    Cc: Martin Peres <[email protected]>
    Cc: Lyude Paul <[email protected]>
    Signed-off-by: Thierry Reding <[email protected]>
    Reviewed-by: Lyude Paul <[email protected]>
    Signed-off-by: Ben Skeggs <[email protected]>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c
index bf62303571b3..3695cde669f8 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c
@@ -301,7 +301,7 @@ nvkm_therm_attr_set(struct nvkm_therm *therm,
 void
 nvkm_therm_clkgate_enable(struct nvkm_therm *therm)
 {
-	if (!therm->func->clkgate_enable || !therm->clkgating_enabled)
+	if (!therm || !therm->func->clkgate_enable || !therm->clkgating_enabled)
 		return;
 
 	nvkm_debug(&therm->subdev,
@@ -312,7 +312,7 @@ nvkm_therm_clkgate_enable(struct nvkm_therm *therm)
 void
 nvkm_therm_clkgate_fini(struct nvkm_therm *therm, bool suspend)
 {
-	if (!therm->func->clkgate_fini || !therm->clkgating_enabled)
+	if (!therm || !therm->func->clkgate_fini || !therm->clkgating_enabled)
 		return;
 
 	nvkm_debug(&therm->subdev,
@@ -395,7 +395,7 @@ void
 nvkm_therm_clkgate_init(struct nvkm_therm *therm,
 			const struct nvkm_therm_clkgate_pack *p)
 {
-	if (!therm->func->clkgate_init || !therm->clkgating_enabled)
+	if (!therm || !therm->func->clkgate_init || !therm->clkgating_enabled)
 		return;
 
 	therm->func->clkgate_init(therm, p);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html