Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c17ef87 authored by Roel Kluin's avatar Roel Kluin Committed by Sascha Hauer
Browse files

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: default avatarRoel Kluin <roel.kluin@gmail.com>
Acked-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 1eaa4f27
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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)