From: Lucas Stach <l.stach@pengutronix.de>
To: Alexander Kurz <akurz@blala.de>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>, barebox@lists.infradead.org
Subject: Re: [PATCH] gpiolib: fix: do not access oftree on non-OFDEVICE boards
Date: Mon, 03 Jul 2017 11:56:00 +0200 [thread overview]
Message-ID: <1499075760.2308.14.camel@pengutronix.de> (raw)
In-Reply-To: <1499027092-2522-1-git-send-email-akurz@blala.de>
Am Sonntag, den 02.07.2017, 22:24 +0200 schrieb Alexander Kurz:
> Non-OFDEVICE boards may have OFTREE=y set, e.g. by BOOTM_OFTREE.
> Attempts to browse the oftree will crash barebox on those boards.
>
> Signed-off-by: Alexander Kurz <akurz@blala.de>
> ---
> drivers/gpio/gpiolib.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index a3e17ad..a1ff965 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -416,7 +416,10 @@ int gpiochip_add(struct gpio_chip *chip)
> for (i = chip->base; i < chip->base + chip->ngpio; i++)
> gpio_desc[i].chip = chip;
>
> - return of_gpiochip_scan_hogs(chip);
> + if (IS_ENABLED(CONFIG_OFDEVICE))
> + return of_gpiochip_scan_hogs(chip);
> + else
> + return 0;
This may also crash in mixed oftree/board file based systems (however
unlikely that is). I think an early return from of_gpiochip_scan_hogs ()
if chip->dev->device_node is NULL would be more robust.
Regards,
Lucas
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2017-07-03 9:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-02 20:24 Alexander Kurz
2017-07-03 9:56 ` Lucas Stach [this message]
2017-07-04 20:17 ` Alexander Kurz
2017-07-05 18:22 ` Sam Ravnborg
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=1499075760.2308.14.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=akurz@blala.de \
--cc=andrew.smirnov@gmail.com \
--cc=barebox@lists.infradead.org \
/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