gpio/ml-ioh: fix off-by-one for displaying variable i in dev_err
authorAxel Lin <axel.lin@gmail.com>
Tue, 14 Jun 2011 11:12:57 +0000 (19:12 +0800)
committerGrant Likely <grant.likely@secretlab.ca>
Thu, 16 Jun 2011 19:44:29 +0000 (13:44 -0600)
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 <axel.lin@gmail.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
drivers/gpio/gpio-ml-ioh.c

index 1bc621ac35364917be287773d081a2801f12a5be..a9016f56ed7e012f7f66fb08ce32e55a1301f4b7 100644 (file)
@@ -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)