0 is not valid IRQ number in Linux interrupt number space. Refactor the code with this kept in mind. Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Cc: Serge Semin <fancer.lancer@xxxxxxxxx> --- v2: drop memchr_inv() use by moving it to the patch which needs it (Serge) drivers/gpio/gpio-dwapb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c index 944dae80d687..c939afac44c9 100644 --- a/drivers/gpio/gpio-dwapb.c +++ b/drivers/gpio/gpio-dwapb.c @@ -417,7 +417,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, int i; for (i = 0; i < pp->ngpio; i++) { - if (pp->irq[i] >= 0) + if (pp->irq[i]) irq_set_chained_handler_and_data(pp->irq[i], dwapb_irq_handler, gpio); } @@ -538,18 +538,18 @@ static void dwapb_get_irq(struct device *dev, struct fwnode_handle *fwnode, struct dwapb_port_property *pp) { struct device_node *np = NULL; - int j; + int irq = -ENXIO, j; if (fwnode_property_read_bool(fwnode, "interrupt-controller")) np = to_of_node(fwnode); for (j = 0; j < pp->ngpio; j++) { - pp->irq[j] = -ENXIO; - if (np) - pp->irq[j] = of_irq_get(np, j); + irq = of_irq_get(np, j); else if (has_acpi_companion(dev)) - pp->irq[j] = platform_get_irq_optional(to_platform_device(dev), j); + irq = platform_get_irq_optional(to_platform_device(dev), j); + if (irq > 0) + pp->irq[j] = irq; if (pp->irq[j] >= 0) pp->has_irq = true; -- 2.26.2