Do this sanity check only once when the gpio_chip is added
rather than every time gpio-hog is handled.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
if (ret)
return ERR_PTR(ret);
- if (tmp > MAX_PHANDLE_ARGS || tmp != chip->of_gpio_n_cells)
+ if (tmp != chip->of_gpio_n_cells)
return ERR_PTR(-EINVAL);
gpiospec.np = chip_np;
chip->of_xlate = of_gpio_simple_xlate;
}
+ if (chip->of_gpio_n_cells > MAX_PHANDLE_ARGS)
+ return -EINVAL;
+
status = of_gpiochip_add_pin_range(chip);
if (status)
return status;