summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorSrinivas Neeli <srinivas.neeli@xilinx.com>2021-01-29 17:26:50 +0300
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2021-02-15 13:43:33 +0300
commit6e551bfa9872cd335d0929411cfdefe99ce65a1d (patch)
tree2a6b05154409d66f63c2857edadef49a6aedb710 /drivers/gpio
parent26b04774621ed333e8bc56479feb6e31625df58c (diff)
downloadlinux-6e551bfa9872cd335d0929411cfdefe99ce65a1d.tar.xz
gpio: gpio-xilinx: Add check if width exceeds 32
Add check to see if gpio-width property does not exceed 32. If it exceeds then return -EINVAL. Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-xilinx.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
index acd574779ca6..b411d3156e0b 100644
--- a/drivers/gpio/gpio-xilinx.c
+++ b/drivers/gpio/gpio-xilinx.c
@@ -589,6 +589,9 @@ static int xgpio_probe(struct platform_device *pdev)
if (of_property_read_u32(np, "xlnx,gpio-width", &chip->gpio_width[0]))
chip->gpio_width[0] = 32;
+ if (chip->gpio_width[0] > 32)
+ return -EINVAL;
+
spin_lock_init(&chip->gpio_lock);
if (of_property_read_u32(np, "xlnx,is-dual", &is_dual))
@@ -613,6 +616,8 @@ static int xgpio_probe(struct platform_device *pdev)
&chip->gpio_width[1]))
chip->gpio_width[1] = 32;
+ if (chip->gpio_width[1] > 32)
+ return -EINVAL;
}
chip->gc.base = -1;