Commit b6c2e77d authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Linus Walleij

gpio: mockup: refuse to accept an odd number of GPIO ranges

Currently we ignore the last odd range value, since each chip is
described by two values. Be more strict and require the user to
pass an even number of ranges.
Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 650b57b0
......@@ -334,7 +334,7 @@ static int gpio_mockup_probe(struct platform_device *pdev)
int ret, i, base, ngpio;
char *chip_name;
if (gpio_mockup_params_nr < 2)
if (gpio_mockup_params_nr < 2 || (gpio_mockup_params_nr % 2))
return -EINVAL;
chips = devm_kzalloc(dev,
......
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