Skip to contentSkip to conversation

pinctrl: coh901: Fix error checking in u300_gpio_to_irq

PATCH In review Axel Lin 2 participants 2 messages Mar 28, 2013 – Apr 3, 2013 Pin control

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 pinctrl: coh901: Fix error checking in u300_gpio_to_irq

The pointer "port" is always not NULL if gpio->port_list is not empty.

---
 drivers/pinctrl/pinctrl-coh901.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-coh901.c +5 -2
index 86887850..edde3ac 100644
@@ -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;
Signature · 1 line
1.7.10.4