Commit 6e551bfa authored by Srinivas Neeli's avatar Srinivas Neeli Committed by Bartosz Golaszewski

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: default avatarSrinivas Neeli <srinivas.neeli@xilinx.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
parent 26b04774
......@@ -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;
......
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