mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +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;
|
return -EINVAL;
|
||||||
|
|
||||||
for (index = 0; index < platform->num_clks; index++) {
|
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)
|
if (err)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -1163,8 +1165,10 @@ static int gk20a_pm_disable_clk(struct device *dev)
|
|||||||
if (!platform)
|
if (!platform)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
for (index = 0; index < platform->num_clks; index++)
|
for (index = 0; index < platform->num_clks; index++) {
|
||||||
|
if (platform->clk[index])
|
||||||
clk_disable_unprepare(platform->clk[index]);
|
clk_disable_unprepare(platform->clk[index]);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,10 @@ err_get_clock:
|
|||||||
clk_put(platform->clk[1]);
|
clk_put(platform->clk[1]);
|
||||||
if (!IS_ERR_OR_NULL(platform->clk[2]))
|
if (!IS_ERR_OR_NULL(platform->clk[2]))
|
||||||
clk_put(platform->clk[2]);
|
clk_put(platform->clk[2]);
|
||||||
|
|
||||||
|
platform->clk[0] = NULL;
|
||||||
|
platform->clk[1] = NULL;
|
||||||
|
platform->clk[2] = NULL;
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user