From: Axel Lin Date: Tue, 14 Jun 2011 11:12:57 +0000 (+0800) Subject: gpio/ml-ioh: fix off-by-one for displaying variable i in dev_err X-Git-Tag: firefly_0821_release~3680^2~5005^2~16 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=33300571b1111264fd0c5701733f7576323f3e35;p=firefly-linux-kernel-4.4.55.git 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 Signed-off-by: Grant Likely --- diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c index 1bc621ac3536..a9016f56ed7e 100644 --- a/drivers/gpio/gpio-ml-ioh.c +++ b/drivers/gpio/gpio-ml-ioh.c @@ -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)