1
0
Fork 0

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: Bartosz Golaszewski <brgl@bgdev.pl>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
hifive-unleashed-5.1
Bartosz Golaszewski 2017-06-09 13:41:27 +02:00 committed by Linus Walleij
parent 650b57b083
commit b6c2e77d34
1 changed files with 1 additions and 1 deletions

View File

@ -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,