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

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 <>
Reviewed-by: default avatarAndy Shevchenko <>
Signed-off-by: default avatarLinus Walleij <>
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,
Supports Markdown
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