Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1432799

[PATCH 4/6] soc/tegra: pmc: Ensure mutex is always initialised

From Jon Hunter <jonathanh@nvidia.com>
Newsgroups linux.kernel
Subject [PATCH 4/6] soc/tegra: pmc: Ensure mutex is always initialised
Date 2016-06-28 12:50 +0200
Message-ID <rOYKD-5Nk-47@gated-at.bofh.it> (permalink)
References <rOYKC-5Nk-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/soc/tegra/pmc.c | 4 ++--
 1 file 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)
 	bool invert;
 	u32 value;
 
+	mutex_init(&pmc->powergates_lock);
+
 	np = of_find_matching_node_and_match(NULL, tegra_pmc_match, &match);
 	if (!np) {
 		/*
@@ -1548,8 +1550,6 @@ static int __init tegra_pmc_early_init(void)
 		return -ENXIO;
 	}
 
-	mutex_init(&pmc->powergates_lock);
-
 	if (np) {
 		pmc->soc = match->data;
 
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] soc/tegra: Various PMC fixes Jon Hunter <jonathanh@nvidia.com> - 2016-06-28 12:50 +0200
  [PATCH 4/6] soc/tegra: pmc: Ensure mutex is always initialised Jon Hunter <jonathanh@nvidia.com> - 2016-06-28 12:50 +0200
  [PATCH 3/6] soc/tegra: pmc: Don't populate soc data until register space is mapped Jon Hunter <jonathanh@nvidia.com> - 2016-06-28 12:50 +0200
  [PATCH 6/6] soc/tegra: pmc: Don't probe pmc if early initialisation fails Jon Hunter <jonathanh@nvidia.com> - 2016-06-28 12:50 +0200
  [PATCH 5/6] soc/tegra: pmc: Add missing of_node_put Jon Hunter <jonathanh@nvidia.com> - 2016-06-28 12:50 +0200
  [PATCH 2/6] soc/tegra: pmc: Fix early initialisation of PMC Jon Hunter <jonathanh@nvidia.com> - 2016-06-28 12:50 +0200
    Re: [PATCH 2/6] soc/tegra: pmc: Fix early initialisation of PMC Jon Hunter <jonathanh@nvidia.com> - 2016-06-29 18:20 +0200
      Re: [PATCH 2/6] soc/tegra: pmc: Fix early initialisation of PMC Thierry Reding <thierry.reding@gmail.com> - 2016-06-30 12:10 +0200
  Re: [PATCH 0/6] soc/tegra: Various PMC fixes Thierry Reding <thierry.reding@gmail.com> - 2016-06-30 12:10 +0200

csiph-web