aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/soc
diff options
context:
space:
mode:
authorJon Hunter <jonathanh@nvidia.com>2016-06-28 06:38:26 -0400
committerThierry Reding <treding@nvidia.com>2016-06-30 06:23:07 -0400
commit61fd284be8be06db1339ca4c9217f5a13b50074f (patch)
treeb9fd610f396fe04a31fec4d33388984f7856f992 /drivers/soc
parent718a2426e82076e4eddc2a041c8e944c9f9b3e61 (diff)
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: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/tegra/pmc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index ed2b2c83e4eb..483d54623ec5 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -1504,6 +1504,8 @@ static int __init tegra_pmc_early_init(void)
1504 bool invert; 1504 bool invert;
1505 u32 value; 1505 u32 value;
1506 1506
1507 mutex_init(&pmc->powergates_lock);
1508
1507 np = of_find_matching_node_and_match(NULL, tegra_pmc_match, &match); 1509 np = of_find_matching_node_and_match(NULL, tegra_pmc_match, &match);
1508 if (!np) { 1510 if (!np) {
1509 /* 1511 /*
@@ -1548,8 +1550,6 @@ static int __init tegra_pmc_early_init(void)
1548 return -ENXIO; 1550 return -ENXIO;
1549 } 1551 }
1550 1552
1551 mutex_init(&pmc->powergates_lock);
1552
1553 if (np) { 1553 if (np) {
1554 pmc->soc = match->data; 1554 pmc->soc = match->data;
1555 1555