From b5bb4f53dbdde8473e1160d4522c5d9da55f115f Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Fri, 24 Oct 2014 14:49:06 +0300 Subject: 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 --- drivers/gpu/nvgpu/gk20a/gk20a.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c') 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) return -EINVAL; for (index = 0; index < platform->num_clks; index++) { - int err = clk_prepare_enable(platform->clk[index]); + int err = 0; + if (platform->clk[index]) + clk_prepare_enable(platform->clk[index]); if (err) return -EINVAL; } @@ -1163,8 +1165,10 @@ static int gk20a_pm_disable_clk(struct device *dev) if (!platform) return -EINVAL; - for (index = 0; index < platform->num_clks; index++) - clk_disable_unprepare(platform->clk[index]); + for (index = 0; index < platform->num_clks; index++) { + if (platform->clk[index]) + clk_disable_unprepare(platform->clk[index]); + } return 0; } -- cgit v1.2.2