From 53ffd779a094d5752551dea2ba7bc787aab29229 Mon Sep 17 00:00:00 2001 From: bui duc phuc Date: Fri, 14 Aug 2026 11:30:26 +0700 Subject: [PATCH] gpio: mlxbf3: Handle errors from optional IRQ lookup platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no optional IRQ is available. Other errors, such as -EPROBE_DEFER and -EINVAL, should be propagated so that the caller can handle them appropriately. Propagate negative errors other than -ENXIO. Signed-off-by: bui duc phuc Link: https://patch.msgid.link/20260814043028.12548-2-phucduc.bui@gmail.com Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-mlxbf3.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-mlxbf3.c b/drivers/gpio/gpio-mlxbf3.c index 566326644a2c..929f64c5140a 100644 --- a/drivers/gpio/gpio-mlxbf3.c +++ b/drivers/gpio/gpio-mlxbf3.c @@ -231,7 +231,9 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev) gc->add_pin_ranges = mlxbf3_gpio_add_pin_ranges; irq = platform_get_irq_optional(pdev, 0); - if (irq >= 0) { + if (irq < 0 && irq != -ENXIO) + return irq; + if (irq > 0) { girq = &gs->chip.gc.irq; gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip); girq->default_type = IRQ_TYPE_NONE;