Skip to content

Commit

Permalink
pinctrl: coh901: Fix error checking in u300_gpio_to_irq
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Axel Lin authored and Linus Walleij committed Apr 3, 2013
1 parent 175ca83 commit 28d0c14
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/pinctrl/pinctrl-coh901.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 28d0c14

Please sign in to comment.