提交 5c17ef87 编写于 作者: R Roel Kluin 提交者: Sascha Hauer

MX1/MX2: -EINVAL overwritten in second iteration in mxc_gpio_setup_multiple_pins()

Due to the `ret = gpio_request()' below in the loop, the initial -EINVAL value
of ret is overwritten.
Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
Acked-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
上级 1eaa4f27
...@@ -116,14 +116,16 @@ int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count, ...@@ -116,14 +116,16 @@ int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
int i; int i;
unsigned gpio; unsigned gpio;
unsigned mode; unsigned mode;
int ret = -EINVAL; int ret;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK); gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
mode = *p & ~(GPIO_PIN_MASK | GPIO_PORT_MASK); mode = *p & ~(GPIO_PIN_MASK | GPIO_PORT_MASK);
if (gpio >= (GPIO_PORT_MAX + 1) * 32) if (gpio >= (GPIO_PORT_MAX + 1) * 32) {
ret = -EINVAL;
goto setup_error; goto setup_error;
}
ret = gpio_request(gpio, label); ret = gpio_request(gpio, label);
if (ret) if (ret)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册