Commit 61fd284b authored by Jon Hunter's avatar Jon Hunter Committed by Thierry Reding

soc/tegra: pmc: Ensure mutex is always initialised

The mutex used by the PMC driver may not be initialised if early
initialisation of the driver fails. If this does happen, then it could
be possible for callers of the public PMC functions to still attempt to
acquire the mutex. Fix this by initialising the mutex as soon as
possible to ensure it will always be initialised.
Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 718a2426
...@@ -1504,6 +1504,8 @@ static int __init tegra_pmc_early_init(void) ...@@ -1504,6 +1504,8 @@ static int __init tegra_pmc_early_init(void)
bool invert; bool invert;
u32 value; u32 value;
mutex_init(&pmc->powergates_lock);
np = of_find_matching_node_and_match(NULL, tegra_pmc_match, &match); np = of_find_matching_node_and_match(NULL, tegra_pmc_match, &match);
if (!np) { if (!np) {
/* /*
...@@ -1548,8 +1550,6 @@ static int __init tegra_pmc_early_init(void) ...@@ -1548,8 +1550,6 @@ static int __init tegra_pmc_early_init(void)
return -ENXIO; return -ENXIO;
} }
mutex_init(&pmc->powergates_lock);
if (np) { if (np) {
pmc->soc = match->data; pmc->soc = match->data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment