summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gk20a.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2014-10-24 07:49:06 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:11:51 -0400
commitb5bb4f53dbdde8473e1160d4522c5d9da55f115f (patch)
tree5520c9cfc69131fc815ce7eac5a2de71a89100d3 /drivers/gpu/nvgpu/gk20a/gk20a.c
parentbe48f4a4519cc285885f8cf886d73ef7675daca8 (diff)
gpu: nvgpu: Enable clocks only if defined
Enable clocks only if they are defined. This prevents panic in cases where clock does not need to be enabled explicitly. Bug 1567274 Change-Id: I7113c6d874b61acc2646effda9c02d3d1817c531 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index c91a316a..85864bcd 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -1146,7 +1146,9 @@ static int gk20a_pm_enable_clk(struct device *dev)
1146 return -EINVAL; 1146 return -EINVAL;
1147 1147
1148 for (index = 0; index < platform->num_clks; index++) { 1148 for (index = 0; index < platform->num_clks; index++) {
1149 int err = clk_prepare_enable(platform->clk[index]); 1149 int err = 0;
1150 if (platform->clk[index])
1151 clk_prepare_enable(platform->clk[index]);
1150 if (err) 1152 if (err)
1151 return -EINVAL; 1153 return -EINVAL;
1152 } 1154 }
@@ -1163,8 +1165,10 @@ static int gk20a_pm_disable_clk(struct device *dev)
1163 if (!platform) 1165 if (!platform)
1164 return -EINVAL; 1166 return -EINVAL;
1165 1167
1166 for (index = 0; index < platform->num_clks; index++) 1168 for (index = 0; index < platform->num_clks; index++) {
1167 clk_disable_unprepare(platform->clk[index]); 1169 if (platform->clk[index])
1170 clk_disable_unprepare(platform->clk[index]);
1171 }
1168 1172
1169 return 0; 1173 return 0;
1170} 1174}