From: Axel Lin Date: Thu, 28 Mar 2013 16:18:12 +0000 (+0800) Subject: pinctrl: coh901: Fix error checking in u300_gpio_to_irq X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=28d0c14b43a04deac8afe27ab700cc7638a7f4ba;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Linus Walleij --- 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) struct u300_gpio_port *port = NULL; struct list_head *p; int retirq; + bool found = false; list_for_each(p, &gpio->port_list) { port = list_entry(p, struct u300_gpio_port, node); - if (port->number == portno) + if (port->number == portno) { + found = true; break; + } } - if (port == NULL) { + if (!found) { dev_err(gpio->dev, "could not locate port for GPIO %d IRQ\n", offset); return -EINVAL;