gpiolib: devprop: Warn if gpio-line-names is too long
PATCH 1/1 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 <[email protected]>
Signed-off-by Stephen Boyd <[email protected]>
--- drivers/gpio/gpiolib-devprop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib-devprop.c +4 -1
@@ -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)
Signature · 1 line
Sent by a computer, using git, on the internet
czw., 23 kwi 2020 o 22:34 Stephen Boyd <[email protected]> napisał(a):
Quoted 30 lines
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 <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- drivers/gpio/gpiolib-devprop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpio/gpiolib-devprop.c +4
-2@@ -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) --
Quoted 2 lines
Sent by a computer, using git, on the internet
Patch applied, thanks!
Bart