From: Jon Hunter <jonathanh@nvidia.com> To: Stephen Warren <swarren@wwwdotorg.org>, Thierry Reding <thierry.reding@gmail.com>, Alexandre Courbot <gnurou@gmail.com> Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Jon Hunter <jonathanh@nvidia.com> Subject: [PATCH 4/6] soc/tegra: pmc: Ensure mutex is always initialised Date: Tue, 28 Jun 2016 11:38:26 +0100 [thread overview] Message-ID: <1467110308-22126-5-git-send-email-jonathanh@nvidia.com> (raw) In-Reply-To: <1467110308-22126-1-git-send-email-jonathanh@nvidia.com> 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
WARNING: multiple messages have this Message-ID (diff)
From: Jon Hunter <jonathanh@nvidia.com> To: Stephen Warren <swarren@wwwdotorg.org>, Thierry Reding <thierry.reding@gmail.com>, Alexandre Courbot <gnurou@gmail.com> Cc: <linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Jon Hunter <jonathanh@nvidia.com> Subject: [PATCH 4/6] soc/tegra: pmc: Ensure mutex is always initialised Date: Tue, 28 Jun 2016 11:38:26 +0100 [thread overview] Message-ID: <1467110308-22126-5-git-send-email-jonathanh@nvidia.com> (raw) In-Reply-To: <1467110308-22126-1-git-send-email-jonathanh@nvidia.com> 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
next prev parent reply other threads:[~2016-06-28 10:38 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-06-28 10:38 [PATCH 0/6] soc/tegra: Various PMC fixes Jon Hunter 2016-06-28 10:38 ` Jon Hunter 2016-06-28 10:38 ` [PATCH 1/6] soc/tegra: pmc: Ensure powergate is available when powering on Jon Hunter 2016-06-28 10:38 ` Jon Hunter 2016-06-28 10:38 ` [PATCH 3/6] soc/tegra: pmc: Don't populate soc data until register space is mapped Jon Hunter 2016-06-28 10:38 ` Jon Hunter 2016-06-28 10:38 ` Jon Hunter [this message] 2016-06-28 10:38 ` [PATCH 4/6] soc/tegra: pmc: Ensure mutex is always initialised Jon Hunter 2016-06-28 10:38 ` [PATCH 5/6] soc/tegra: pmc: Add missing of_node_put Jon Hunter 2016-06-28 10:38 ` Jon Hunter 2016-06-28 10:46 ` Jon Hunter 2016-06-28 10:46 ` Jon Hunter 2016-06-28 10:38 ` [PATCH 6/6] soc/tegra: pmc: Don't probe pmc if early initialisation fails Jon Hunter 2016-06-28 10:38 ` Jon Hunter [not found] ` <1467110308-22126-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2016-06-28 10:38 ` [PATCH 2/6] soc/tegra: pmc: Fix early initialisation of PMC Jon Hunter 2016-06-28 10:38 ` Jon Hunter [not found] ` <1467110308-22126-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2016-06-29 16:17 ` Jon Hunter 2016-06-29 16:17 ` Jon Hunter [not found] ` <5773F485.8090504-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2016-06-30 10:03 ` Thierry Reding 2016-06-30 10:03 ` Thierry Reding 2016-06-28 10:40 ` [PATCH 0/6] soc/tegra: Various PMC fixes Jon Hunter 2016-06-28 10:40 ` Jon Hunter 2016-06-30 10:04 ` Thierry Reding 2016-06-30 10:04 ` Thierry Reding
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1467110308-22126-5-git-send-email-jonathanh@nvidia.com \ --to=jonathanh@nvidia.com \ --cc=gnurou@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-tegra@vger.kernel.org \ --cc=swarren@wwwdotorg.org \ --cc=thierry.reding@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.