All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@free-electrons.com>
To: Jean-Jacques Hiblot <jjhiblot@traphandler.com>,
	nicolas.ferre@atmel.com, plagnioj@jcrosoft.com,
	b.brezillon@overkiz.com
Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 1/8] at91: dt: Adds support for the bus matrix declaration in the DT
Date: Wed, 12 Feb 2014 11:45:15 +0100	[thread overview]
Message-ID: <52FB50BB.5070603@free-electrons.com> (raw)
In-Reply-To: <1392199607-27452-2-git-send-email-jjhiblot@traphandler.com>

Hi Jean-Jacques,

Thanks for this new series, I have one little comment:

On 12/02/2014 11:06, Jean-Jacques Hiblot wrote:
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
> ---
>  arch/arm/mach-at91/setup.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
> index f7ca97b..b8d0b66 100644
> --- a/arch/arm/mach-at91/setup.c
> +++ b/arch/arm/mach-at91/setup.c
> @@ -487,6 +487,28 @@ end:
>  	of_node_put(np);
>  }
>  
> +static struct of_device_id matrix_ids[] = {
> +	{ .compatible = "atmel,at91sam9261-bus-matrix", },
> +	{ /*sentinel*/ }
> +};
> +
> +static void at91_dt_matrix(void)
> +{
> +	struct device_node *np;
> +
> +	np = of_find_matching_node(NULL, matrix_ids);
> +	if (!np) {
> +		pr_debug("AT91: unable to find compatible bus matrix controller node in dtb\n");

I think that a panic here should be more consistent with the next check.
Indeed if it fails here then at91_matrix_base will be uninitialized too,
and it will make the kernel crash when at91_matrix_base will be accessed.

Thanks,

Gregory


> +		return;
> +	}
> +
> +	at91_matrix_base = of_iomap(np, 0);
> +	if (!at91_matrix_base)
> +		panic("Impossible to ioremap at91_matrix_base\n");
> +
> +	of_node_put(np);
> +}
> +
>  void __init at91rm9200_dt_initialize(void)
>  {
>  	at91_dt_ramc();
> @@ -506,6 +528,7 @@ void __init at91_dt_initialize(void)
>  	at91_dt_rstc();
>  	at91_dt_ramc();
>  	at91_dt_shdwc();
> +	at91_dt_matrix();
>  
>  	/* Init clock subsystem */
>  	at91_dt_clock_init();
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: gregory.clement@free-electrons.com (Gregory CLEMENT)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 1/8] at91: dt: Adds support for the bus matrix declaration in the DT
Date: Wed, 12 Feb 2014 11:45:15 +0100	[thread overview]
Message-ID: <52FB50BB.5070603@free-electrons.com> (raw)
In-Reply-To: <1392199607-27452-2-git-send-email-jjhiblot@traphandler.com>

Hi Jean-Jacques,

Thanks for this new series, I have one little comment:

On 12/02/2014 11:06, Jean-Jacques Hiblot wrote:
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
> ---
>  arch/arm/mach-at91/setup.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
> index f7ca97b..b8d0b66 100644
> --- a/arch/arm/mach-at91/setup.c
> +++ b/arch/arm/mach-at91/setup.c
> @@ -487,6 +487,28 @@ end:
>  	of_node_put(np);
>  }
>  
> +static struct of_device_id matrix_ids[] = {
> +	{ .compatible = "atmel,at91sam9261-bus-matrix", },
> +	{ /*sentinel*/ }
> +};
> +
> +static void at91_dt_matrix(void)
> +{
> +	struct device_node *np;
> +
> +	np = of_find_matching_node(NULL, matrix_ids);
> +	if (!np) {
> +		pr_debug("AT91: unable to find compatible bus matrix controller node in dtb\n");

I think that a panic here should be more consistent with the next check.
Indeed if it fails here then at91_matrix_base will be uninitialized too,
and it will make the kernel crash when at91_matrix_base will be accessed.

Thanks,

Gregory


> +		return;
> +	}
> +
> +	at91_matrix_base = of_iomap(np, 0);
> +	if (!at91_matrix_base)
> +		panic("Impossible to ioremap at91_matrix_base\n");
> +
> +	of_node_put(np);
> +}
> +
>  void __init at91rm9200_dt_initialize(void)
>  {
>  	at91_dt_ramc();
> @@ -506,6 +528,7 @@ void __init at91_dt_initialize(void)
>  	at91_dt_rstc();
>  	at91_dt_ramc();
>  	at91_dt_shdwc();
> +	at91_dt_matrix();
>  
>  	/* Init clock subsystem */
>  	at91_dt_clock_init();
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2014-02-12 10:45 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 10:06 [PATCH v4 0/8] Device Tree support for the at91sam9261ek Jean-Jacques Hiblot
2014-02-12 10:06 ` Jean-Jacques Hiblot
2014-02-12 10:06 ` [PATCH v4 1/8] at91: dt: Adds support for the bus matrix declaration in the DT Jean-Jacques Hiblot
2014-02-12 10:06   ` Jean-Jacques Hiblot
2014-02-12 10:45   ` Gregory CLEMENT [this message]
2014-02-12 10:45     ` Gregory CLEMENT
2014-02-12 10:54     ` Nicolas Ferre
2014-02-12 10:54       ` Nicolas Ferre
2014-02-12 10:06 ` [PATCH v4 2/8] at91: pinctrl: don't request GPIOs used for interrupts but lock them as IRQ Jean-Jacques Hiblot
2014-02-12 10:06   ` Jean-Jacques Hiblot
2014-02-12 17:47   ` Nicolas Ferre
2014-02-12 17:47     ` Nicolas Ferre
2014-02-24 13:25   ` Linus Walleij
2014-02-24 13:25     ` Linus Walleij
2014-02-25  9:35     ` Jean-Jacques Hiblot
2014-02-25  9:35       ` Jean-Jacques Hiblot
2014-02-25  9:47       ` Jean-Jacques Hiblot
2014-02-25  9:47         ` Jean-Jacques Hiblot
2014-02-12 10:06 ` [PATCH v4 3/8] at91: dt: Add at91sam9261 dt SoC support Jean-Jacques Hiblot
2014-02-12 10:06   ` Jean-Jacques Hiblot
2014-02-12 17:28   ` Alexandre Belloni
2014-02-12 17:28     ` Alexandre Belloni
2014-02-12 19:47     ` Jean-Jacques Hiblot
2014-02-12 19:47       ` Jean-Jacques Hiblot
2014-02-13  8:10       ` Nicolas Ferre
2014-02-13  8:10         ` Nicolas Ferre
2014-02-13  8:54         ` Alexandre Belloni
2014-02-13  8:54           ` Alexandre Belloni
2014-02-12 21:04   ` Alexandre Belloni
2014-02-12 21:04     ` Alexandre Belloni
2014-02-13  6:11     ` Jean-Jacques Hiblot
2014-02-13  6:11       ` Jean-Jacques Hiblot
2014-02-12 10:06 ` [PATCH v4 4/8] at91: dt: defconfig: Added the sam9261 to the list of DT-enabled SOCs Jean-Jacques Hiblot
2014-02-12 10:06   ` Jean-Jacques Hiblot
2014-02-12 10:06 ` [PATCH v4 5/8] at91: dt: sam9261: Device Tree support for the at91sam9261ek Jean-Jacques Hiblot
2014-02-12 10:06   ` Jean-Jacques Hiblot
2014-02-12 10:06 ` [PATCH v4 6/8] at91: updated the at91_dt_defconfig with support for the ADS7846 Jean-Jacques Hiblot
2014-02-12 10:06   ` Jean-Jacques Hiblot
2014-02-12 10:06 ` [PATCH v4 7/8] ARM: at91: prepare common clk transition for sam9261 SoC Jean-Jacques Hiblot
2014-02-12 10:06   ` Jean-Jacques Hiblot
2014-02-12 10:06 ` [PATCH v4 8/8] ARM: at91: move sam9261 SoC to common clk Jean-Jacques Hiblot
2014-02-12 10:06   ` Jean-Jacques Hiblot
2014-02-12 11:14 ` [PATCH v4 0/8] Device Tree support for the at91sam9261ek Gregory CLEMENT
2014-02-12 11:14   ` Gregory CLEMENT
2014-02-12 12:34   ` Thomas Petazzoni
2014-02-12 12:34     ` Thomas Petazzoni
2014-02-12 12:36     ` Jean-Jacques Hiblot
2014-02-12 12:36       ` Jean-Jacques Hiblot
2014-02-12 12:44       ` Thomas Petazzoni
2014-02-12 12:44         ` Thomas Petazzoni
2014-02-12 13:01         ` Jean-Jacques Hiblot
2014-02-12 13:01           ` Jean-Jacques Hiblot
2014-02-12 12:35   ` Jean-Jacques Hiblot
2014-02-12 12:35     ` Jean-Jacques Hiblot

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=52FB50BB.5070603@free-electrons.com \
    --to=gregory.clement@free-electrons.com \
    --cc=b.brezillon@overkiz.com \
    --cc=jjhiblot@traphandler.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=plagnioj@jcrosoft.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 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.