mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 18:16:01 +03:00
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>
This commit is contained in:
committed by
Dan Willemsen
parent
be48f4a451
commit
b5bb4f53db
@@ -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;
|
||||
}
|
||||
|
||||
@@ -96,6 +96,10 @@ err_get_clock:
|
||||
clk_put(platform->clk[1]);
|
||||
if (!IS_ERR_OR_NULL(platform->clk[2]))
|
||||
clk_put(platform->clk[2]);
|
||||
|
||||
platform->clk[0] = NULL;
|
||||
platform->clk[1] = NULL;
|
||||
platform->clk[2] = NULL;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user