linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpiolib: devprop: Warn if gpio-line-names is too long
@ 2020-04-23 20:34 Stephen Boyd
  2020-04-24  7:10 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Boyd @ 2020-04-23 20:34 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: linux-kernel, linux-gpio, Alexandru M Stan

Some DT authors (including myself) have messed up the length of
gpio-line-names and made it longer than it should be. Add a warning here
so that developers can figure out that they've messed up their DT and
should fix it.

Cc: Alexandru M Stan <amstan@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/gpio/gpiolib-devprop.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib-devprop.c b/drivers/gpio/gpiolib-devprop.c
index 53781b253986..26741032fa9e 100644
--- a/drivers/gpio/gpiolib-devprop.c
+++ b/drivers/gpio/gpiolib-devprop.c
@@ -37,8 +37,11 @@ void devprop_gpiochip_set_names(struct gpio_chip *chip,
 	if (count < 0)
 		return;
 
-	if (count > gdev->ngpio)
+	if (count > gdev->ngpio) {
+		dev_warn(&gdev->dev, "gpio-line-names is length %d but should be at most length %d",
+			 count, gdev->ngpio);
 		count = gdev->ngpio;
+	}
 
 	names = kcalloc(count, sizeof(*names), GFP_KERNEL);
 	if (!names)
-- 
Sent by a computer, using git, on the internet


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpiolib: devprop: Warn if gpio-line-names is too long
  2020-04-23 20:34 [PATCH] gpiolib: devprop: Warn if gpio-line-names is too long Stephen Boyd
@ 2020-04-24  7:10 ` Bartosz Golaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2020-04-24  7:10 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Linus Walleij, LKML, linux-gpio, Alexandru M Stan

czw., 23 kwi 2020 o 22:34 Stephen Boyd <swboyd@chromium.org> napisał(a):
>
> Some DT authors (including myself) have messed up the length of
> gpio-line-names and made it longer than it should be. Add a warning here
> so that developers can figure out that they've messed up their DT and
> should fix it.
>
> Cc: Alexandru M Stan <amstan@chromium.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>  drivers/gpio/gpiolib-devprop.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib-devprop.c b/drivers/gpio/gpiolib-devprop.c
> index 53781b253986..26741032fa9e 100644
> --- a/drivers/gpio/gpiolib-devprop.c
> +++ b/drivers/gpio/gpiolib-devprop.c
> @@ -37,8 +37,11 @@ void devprop_gpiochip_set_names(struct gpio_chip *chip,
>         if (count < 0)
>                 return;
>
> -       if (count > gdev->ngpio)
> +       if (count > gdev->ngpio) {
> +               dev_warn(&gdev->dev, "gpio-line-names is length %d but should be at most length %d",
> +                        count, gdev->ngpio);
>                 count = gdev->ngpio;
> +       }
>
>         names = kcalloc(count, sizeof(*names), GFP_KERNEL);
>         if (!names)
> --
> Sent by a computer, using git, on the internet
>

Patch applied, thanks!

Bart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-24  7:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23 20:34 [PATCH] gpiolib: devprop: Warn if gpio-line-names is too long Stephen Boyd
2020-04-24  7:10 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).