diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2014-10-24 07:49:06 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:11:51 -0400 |
commit | b5bb4f53dbdde8473e1160d4522c5d9da55f115f (patch) | |
tree | 5520c9cfc69131fc815ce7eac5a2de71a89100d3 /drivers/gpu/nvgpu/gk20a | |
parent | be48f4a4519cc285885f8cf886d73ef7675daca8 (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')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 10 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_gk20a_generic.c | 4 |
2 files changed, 11 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 | } |
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a_generic.c b/drivers/gpu/nvgpu/gk20a/platform_gk20a_generic.c index 9b544ffc..d5b82fcc 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a_generic.c +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a_generic.c | |||
@@ -96,6 +96,10 @@ err_get_clock: | |||
96 | clk_put(platform->clk[1]); | 96 | clk_put(platform->clk[1]); |
97 | if (!IS_ERR_OR_NULL(platform->clk[2])) | 97 | if (!IS_ERR_OR_NULL(platform->clk[2])) |
98 | clk_put(platform->clk[2]); | 98 | clk_put(platform->clk[2]); |
99 | |||
100 | platform->clk[0] = NULL; | ||
101 | platform->clk[1] = NULL; | ||
102 | platform->clk[2] = NULL; | ||
99 | return -ENODEV; | 103 | return -ENODEV; |
100 | } | 104 | } |
101 | 105 | ||