提交 1020dfd1 编写于 作者: M Masahiro Yamada 提交者: Linus Walleij

gpio: of: move chip->of_gpio_n_cells checking to of_gpiochip_add()

Do this sanity check only once when the gpio_chip is added
rather than every time gpio-hog is handled.
Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 be715343
......@@ -155,7 +155,7 @@ static struct gpio_desc *of_parse_own_gpio(struct device_node *np,
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;
......@@ -486,6 +486,9 @@ int of_gpiochip_add(struct gpio_chip *chip)
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册