Commit 9784c996 authored by Stephen Boyd's avatar Stephen Boyd Committed by Bartosz Golaszewski

gpiolib: devprop: Warn if gpio-line-names is too long

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: default avatarStephen Boyd <swboyd@chromium.org>
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
parent aa58a21a
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment