gpio: altera: 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 <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260814043028.12548-4-phucduc.bui@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
This commit is contained in:
bui duc phuc 2026-08-14 11:30:28 +07:00 committed by Bartosz Golaszewski
parent d8aaf6b0fd
commit 6e6e585b60

View File

@ -220,8 +220,11 @@ static int altera_gpio_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
mapped_irq = platform_get_irq_optional(pdev, 0); mapped_irq = platform_get_irq_optional(pdev, 0);
if (mapped_irq < 0) if (mapped_irq < 0) {
if (irq != -ENXIO)
return irq;
goto skip_irq; goto skip_irq;
}
if (device_property_read_u32(dev, "altr,interrupt-type", &reg)) { if (device_property_read_u32(dev, "altr,interrupt-type", &reg)) {
dev_err(&pdev->dev, dev_err(&pdev->dev,