mirror of https://gitee.com/openkylin/linux.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 <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
175ca83c0b
commit
28d0c14b43
|
@ -318,13 +318,16 @@ static int u300_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
|
||||||
struct u300_gpio_port *port = NULL;
|
struct u300_gpio_port *port = NULL;
|
||||||
struct list_head *p;
|
struct list_head *p;
|
||||||
int retirq;
|
int retirq;
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
list_for_each(p, &gpio->port_list) {
|
list_for_each(p, &gpio->port_list) {
|
||||||
port = list_entry(p, struct u300_gpio_port, node);
|
port = list_entry(p, struct u300_gpio_port, node);
|
||||||
if (port->number == portno)
|
if (port->number == portno) {
|
||||||
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (port == NULL) {
|
if (!found) {
|
||||||
dev_err(gpio->dev, "could not locate port for GPIO %d IRQ\n",
|
dev_err(gpio->dev, "could not locate port for GPIO %d IRQ\n",
|
||||||
offset);
|
offset);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Reference in New Issue