Skip to contentSkip to conversation

M28: Fix OB1 bug in GPIO driver

PATCH New Robert Deliën 3 participants 6 messages Nov 22, 2011 – Nov 25, 2011 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 M28: Fix OB1 bug in GPIO driver

This patch fixes a small off-by-one bug in the GPIO driver for the mxs platform that allowed the selection gpio pins of one bank more than the SoC actually has.

drivers/gpio/mxs_gpio.c +1 -1
index b7e9591..539738b 100644
@@ -120,7 +120,7 @@ int gpio_direction_output(int gp, int value)
 
 int gpio_request(int gp, const char *label)
 {
-       if (PAD_BANK(gp) > PINCTRL_BANKS)
+       if (PAD_BANK(gp) >= PINCTRL_BANKS)
                return -EINVAL;
 
        return 0;
#1 lore raw

PATCH 1/1 M28: Fix OB1 bug in GPIO driver

Quoted 11 lines

This patch fixes a small off-by-one bug in the GPIO driver for the mxs platform that allowed the selection gpio pins of one bank more than the SoC actually has.

drivers/gpio/mxs_gpio.c +0 -0
index b7e9591..539738b 100644

drivers/gpio/mxs_gpio.c int gpio_direction_output(int gp, int value) · line 126

Quoted 8 lines
drivers/gpio/mxs_gpio.c +1 -1
@@ -120,7 +120,7 @@ int gpio_direction_output(int gp, int value)
 
 int gpio_request(int gp, const char *label)
 {
-       if (PAD_BANK(gp) > PINCTRL_BANKS)
+       if (PAD_BANK(gp) >= PINCTRL_BANKS)
                return -EINVAL;
 
        return 0;

Good catch, I'll verify and ack afterwards.

Thanks

M

#2 lore raw

PATCH 1/1 M28: Fix OB1 bug in GPIO driver

In reply to Robert Deliën
Quoted 11 lines

This patch fixes a small off-by-one bug in the GPIO driver for the mxs platform that allowed the selection gpio pins of one bank more than the SoC actually has.

drivers/gpio/mxs_gpio.c +0 -0
index b7e9591..539738b 100644

drivers/gpio/mxs_gpio.c int gpio_direction_output(int gp, int value) · line 126

Quoted 8 lines
drivers/gpio/mxs_gpio.c +1 -1
@@ -120,7 +120,7 @@ int gpio_direction_output(int gp, int value)
 
 int gpio_request(int gp, const char *label)
 {
-       if (PAD_BANK(gp) > PINCTRL_BANKS)
+       if (PAD_BANK(gp) >= PINCTRL_BANKS)
                return -EINVAL;
 
        return 0;

I'd like to see Stefano review this too.

M

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

PATCH 1/1 M28: Fix OB1 bug in GPIO driver

Quoted 5 lines
Quoted 3 lines

Sure, I wrote the code, I know what it does and where you see the problem. It's just to be dead sure. Anyway, I acked it so it means I agree with the change.

Of course. Thanks. Hence my elaboration, to make your checks easier.

Please, ALWAYS Cc the mailing list

#6 lore raw

PATCH 1/1 M28: Fix OB1 bug in GPIO driver

In reply to Robert Deliën
Quoted 11 lines

This patch fixes a small off-by-one bug in the GPIO driver for the mxs platform that allowed the selection gpio pins of one bank more than the SoC actually has.

drivers/gpio/mxs_gpio.c +0 -0
index b7e9591..539738b 100644

drivers/gpio/mxs_gpio.c int gpio_direction_output(int gp, int value) · line 126

Quoted 8 lines
drivers/gpio/mxs_gpio.c +1 -1
@@ -120,7 +120,7 @@ int gpio_direction_output(int gp, int value)
 
 int gpio_request(int gp, const char *label)
 {
-       if (PAD_BANK(gp) > PINCTRL_BANKS)
+       if (PAD_BANK(gp) >= PINCTRL_BANKS)
                return -EINVAL;
 
        return 0;

Stefano, can you please apply ?

#7 lore raw

PATCH 1/1 M28: Fix OB1 bug in GPIO driver

In reply to Robert Deliën
Quoted 10 lines · Robert Deli?n

This patch fixes a small off-by-one bug in the GPIO driver for the mxs platform that allowed the selection gpio pins of one bank more than the SoC actually has.

drivers/gpio/mxs_gpio.c +0 -0
index b7e9591..539738b 100644

drivers/gpio/mxs_gpio.c int gpio_direction_output(int gp, int value) · line 126

Quoted 8 lines
drivers/gpio/mxs_gpio.c +1 -1
@@ -120,7 +120,7 @@ int gpio_direction_output(int gp, int value)
 
 int gpio_request(int gp, const char *label)
 {
-       if (PAD_BANK(gp) > PINCTRL_BANKS)
+       if (PAD_BANK(gp) >= PINCTRL_BANKS)
                return -EINVAL;
 
        return 0;

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================