Skip to content

Commit

Permalink
MX1/MX2: -EINVAL overwritten in second iteration in mxc_gpio_setup_mu…
Browse files Browse the repository at this point in the history
…ltiple_pins()

Due to the `ret = gpio_request()' below in the loop, the initial -EINVAL value
of ret is overwritten.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
  • Loading branch information
Roel Kluin authored and Sascha Hauer committed Feb 4, 2010
1 parent 1eaa4f2 commit 5c17ef8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/arm/plat-mxc/iomux-mx1-mx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,16 @@ int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
int i;
unsigned gpio;
unsigned mode;
int ret = -EINVAL;
int ret;

for (i = 0; i < count; i++) {
gpio = *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;
}

ret = gpio_request(gpio, label);
if (ret)
Expand Down

0 comments on commit 5c17ef8

Please sign in to comment.