aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-03-28 12:18:12 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-04-03 08:31:19 -0400
commit28d0c14b43a04deac8afe27ab700cc7638a7f4ba (patch)
tree74b5100ea1102035f7a6b655ebb4e5bdf850e9a7
parent175ca83c0b6ab3c2af2d9e1ffff4d274910bbc10 (diff)
pinctrl: coh901: Fix error checking in u300_gpio_to_irq
The pointer "port" is always not NULL if gpio->port_list is not empty. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/pinctrl-coh901.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c
index 86887850ac13..edde3acc4186 100644
--- a/drivers/pinctrl/pinctrl-coh901.c
+++ b/drivers/pinctrl/pinctrl-coh901.c
@@ -318,13 +318,16 @@ static int u300_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
318 struct u300_gpio_port *port = NULL; 318 struct u300_gpio_port *port = NULL;
319 struct list_head *p; 319 struct list_head *p;
320 int retirq; 320 int retirq;
321 bool found = false;
321 322
322 list_for_each(p, &gpio->port_list) { 323 list_for_each(p, &gpio->port_list) {
323 port = list_entry(p, struct u300_gpio_port, node); 324 port = list_entry(p, struct u300_gpio_port, node);
324 if (port->number == portno) 325 if (port->number == portno) {
326 found = true;
325 break; 327 break;
328 }
326 } 329 }
327 if (port == NULL) { 330 if (!found) {
328 dev_err(gpio->dev, "could not locate port for GPIO %d IRQ\n", 331 dev_err(gpio->dev, "could not locate port for GPIO %d IRQ\n",
329 offset); 332 offset);
330 return -EINVAL; 333 return -EINVAL;