Commit 20c35ac4 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Linus Walleij

gpio: mockup: parse the module params in init, not probe

If the module parameters are invalid, we should bail out from the init
function instead of detecting it during the device probe. That way we
don't even allow the user to load the module if we don't accept the
arguments.
Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent f3b47170
...@@ -275,9 +275,6 @@ static int gpio_mockup_probe(struct platform_device *pdev) ...@@ -275,9 +275,6 @@ static int gpio_mockup_probe(struct platform_device *pdev)
struct gpio_mockup_chip *chips; struct gpio_mockup_chip *chips;
char *chip_name; char *chip_name;
if (gpio_mockup_params_nr < 2 || (gpio_mockup_params_nr % 2))
return -EINVAL;
/* Each chip is described by two values. */ /* Each chip is described by two values. */
num_chips = gpio_mockup_params_nr / 2; num_chips = gpio_mockup_params_nr / 2;
...@@ -333,6 +330,9 @@ static int __init gpio_mockup_init(void) ...@@ -333,6 +330,9 @@ static int __init gpio_mockup_init(void)
{ {
int err; int err;
if (gpio_mockup_params_nr < 2 || (gpio_mockup_params_nr % 2))
return -EINVAL;
gpio_mockup_dbg_dir = debugfs_create_dir("gpio-mockup-event", NULL); gpio_mockup_dbg_dir = debugfs_create_dir("gpio-mockup-event", NULL);
if (!gpio_mockup_dbg_dir) if (!gpio_mockup_dbg_dir)
pr_err("%s: error creating debugfs directory\n", pr_err("%s: error creating debugfs directory\n",
......
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