* [PATCH] MX1/MX2: -EINVAL overwritten in second iteration in mxc_gpio_setup_multiple_pins()
@ 2010-02-03 19:19 Roel Kluin
2010-02-03 20:56 ` Uwe Kleine-König
0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2010-02-03 19:19 UTC (permalink / raw)
To: linux-arm-kernel
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>
---
Not 100% sure this is needed, please review. One more question: is it ok
to return 0 when count is 0 (and nothing is done)?
diff --git a/arch/arm/plat-mxc/iomux-mx1-mx2.c b/arch/arm/plat-mxc/iomux-mx1-mx2.c
index a37163c..25023ac 100644
--- a/arch/arm/plat-mxc/iomux-mx1-mx2.c
+++ b/arch/arm/plat-mxc/iomux-mx1-mx2.c
@@ -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)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] MX1/MX2: -EINVAL overwritten in second iteration in mxc_gpio_setup_multiple_pins()
2010-02-03 19:19 [PATCH] MX1/MX2: -EINVAL overwritten in second iteration in mxc_gpio_setup_multiple_pins() Roel Kluin
@ 2010-02-03 20:56 ` Uwe Kleine-König
0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2010-02-03 20:56 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Feb 03, 2010 at 08:19:00PM +0100, Roel Kluin wrote:
> 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>
> ---
> Not 100% sure this is needed, please review. One more question: is it ok
> to return 0 when count is 0 (and nothing is done)?
I'd say yes. If you want nothing from me, I can say I gave you all you
wanted without doing anything.
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-02-03 20:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-03 19:19 [PATCH] MX1/MX2: -EINVAL overwritten in second iteration in mxc_gpio_setup_multiple_pins() Roel Kluin
2010-02-03 20:56 ` Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).