summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib-devprop.c
diff options
context:
space:
mode:
authorStephen Boyd <swboyd@chromium.org>2020-04-23 22:34:16 +0200
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2020-04-24 09:10:01 +0200
commit9784c9963feccd8dede924dbc0f8b1c64506e646 (patch)
treec7378f6790b977625d708bec4a529f3022d7ae5c /drivers/gpio/gpiolib-devprop.c
parentgpio: pca953x: disable regmap locking (diff)
downloadlinux-9784c9963feccd8dede924dbc0f8b1c64506e646.tar.xz
linux-9784c9963feccd8dede924dbc0f8b1c64506e646.zip
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: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'drivers/gpio/gpiolib-devprop.c')
-rw-r--r--drivers/gpio/gpiolib-devprop.c5
1 files changed, 4 insertions, 1 deletions
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)