mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@st.com>
To: Nicholas Mc Guire <hofrat@osadl.org>,
	Srinivas Kandagatla <srinivas.kandagatla@st.com>
Cc: Russell King <linux@armlinux.org.uk>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2] ARM: STi: warn if scu mapping fails
Date: Wed, 18 Jul 2018 07:17:48 +0000	[thread overview]
Message-ID: <6cf0542b-cb50-33d4-25eb-51b7e303905d@st.com> (raw)
In-Reply-To: <1531748809-12540-1-git-send-email-hofrat@osadl.org>

Hi Nicholas

On 07/16/2018 03:46 PM, Nicholas Mc Guire wrote:
>   If the device node is not found or the of_iomap() failed, calling
> scu_enable would not be safe and could lead to an undefined system
> state. So warn in both failure paths before returning.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> Link: http://lkml.org/lkml/2018/7/16/219
> Fixes: commit 65ebcc115889 ("ARM: sti: Add STiH415 SOC support")
> ---
> 
> V2: replacement of WARN_ON() by a meaningful pr_err as suggested by
>      Patrice CHOTARD <patrice.chotard@st.com>.
> 
> Problem was found by an experimental coccinelle script
> 
> Patch was compile tested with: multi_v7_defconfig (implies
> CONFIG_ARCH_STI=y, CONFIG_SMP=y)
> (with one sparse warning unrelated to the proposed change)
> 
> Patch is against 4.18-rc4 (localversion-next is next-20180716)
> 
>   arch/arm/mach-sti/platsmp.c | 18 ++++++++++++++----
>   1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c
> index 231f19e..530e9a5 100644
> --- a/arch/arm/mach-sti/platsmp.c
> +++ b/arch/arm/mach-sti/platsmp.c
> @@ -107,12 +107,22 @@ static void __init sti_smp_prepare_cpus(unsigned int max_cpus)
>   
>   	np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
>   
> -	if (np) {
> -		scu_base = of_iomap(np, 0);
> -		scu_enable(scu_base);
> -		of_node_put(np);
> +	if (!np) {
> +		pr_err("SCU not found at %s:%s():%d\n",
> +		       __FILE__, __func__, __LINE__);
> +		return;
>   	}
>   
> +	scu_base = of_iomap(np, 0);
> +	of_node_put(np);
> +	if (!scu_base) {
> +		pr_err("SCU remap failed at %s:%s():%d\n",
> +		       __FILE__, __func__, __LINE__);
> +		return;
> +	}
> +
> +	scu_enable(scu_base);
> +
>   	if (max_cpus <= 1)
>   		return;
>   
> 
Acked-by: Patrice Chotard <patrice.chotard@st.com>

Patrice

  reply	other threads:[~2018-07-18  7:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 13:46 Nicholas Mc Guire
2018-07-18  7:17 ` Patrice CHOTARD [this message]
2019-04-13  7:14 [PATCH 0/4] ARM: imx legacy: cleanups Nicholas Mc Guire
2019-04-13  7:14 ` [PATCH V2] ARM: STi: warn if scu mapping fails Nicholas Mc Guire

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=6cf0542b-cb50-33d4-25eb-51b7e303905d@st.com \
    --to=patrice.chotard@st.com \
    --cc=hofrat@osadl.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=srinivas.kandagatla@st.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®