gpio: gpio-ml-ioh: fix off-by-one for displaying variable i in dev_err
Subsystems (2)
PATCH 1/1 gpio: gpio-ml-ioh: fix off-by-one for displaying variable i in dev_err
with the "for (; i != 0; i--)" sytax, i-- will be executed after the iteration. thus dev_err shows wrong i value.
Switch to "while(--i >= 0)" which is better in readability.
Signed-off-by Axel Lin <[email protected]>
--- drivers/gpio/gpio-ml-ioh.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpio/gpio-ml-ioh.c +1 -1
@@ -233,7 +233,7 @@ static int __devinit ioh_gpio_probe(struct pci_dev *pdev,return 0 ; err_gpiochip_add: -for (; i !=0 ; i--) { +while (--i >=0 ) { chip--; ret =gpiochip_remove (&chip->gpio);if (ret)
Signature · 1 line
1.7.4.1
Grant Likely
AppliedQuoted 5 lines · Axel Lin
with the "for (; i != 0; i--)" sytax, i-- will be executed after the iteration. thus
dev_errshows wrong i value.
Switch to "while(--i >= 0)" which is better in readability.Signed-off-by Axel Lin <[email protected]>
Merged, thanks.
g.
Quoted 22 lines
--- drivers/gpio/gpio-ml-ioh.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/gpio/gpio-ml-ioh.c +1
-1@@ -233,7 +233,7 @@ static int __devinit ioh_gpio_probe(struct pci_dev *pdev,return 0 ; err_gpiochip_add: -for (; i !=0 ; i--) { +while (--i >=0 ) { chip--; ret =gpiochip_remove (&chip->gpio);if (ret)Signature · 1 line
1.7.4.1