Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

gpio: mockup: verify the number of GPIO chips requested



The number of supported mockup chips is limited. Check this limit when
parsing the module parameters.

Also: make sure that each chip is described with a <base - ngpio> pair.

Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 20c35ac4
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -330,7 +330,9 @@ static int __init gpio_mockup_init(void)
{
{
	int err;
	int err;


	if (gpio_mockup_params_nr < 2 || (gpio_mockup_params_nr % 2))
	if ((gpio_mockup_params_nr < 2) ||
	    (gpio_mockup_params_nr % 2) ||
	    (gpio_mockup_params_nr > GPIO_MOCKUP_MAX_RANGES))
		return -EINVAL;
		return -EINVAL;


	gpio_mockup_dbg_dir = debugfs_create_dir("gpio-mockup-event", NULL);
	gpio_mockup_dbg_dir = debugfs_create_dir("gpio-mockup-event", NULL);