All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: sophgo-saradc: Handle errors from optional IRQ lookup
@ 2026-08-13  7:48 phucduc.bui
  0 siblings, 0 replies; only message in thread
From: phucduc.bui @ 2026-08-13  7:48 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, nuno.sa, Chen Wang,
	Inochi Amaoto, Takashi Sakamoto, u.kleine-koenig,
	Danilo Krummrich, Bjorn Helgaas, linux-iio, sophgo
  Cc: linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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>
---
 drivers/iio/adc/sophgo-cv1800b-adc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/adc/sophgo-cv1800b-adc.c b/drivers/iio/adc/sophgo-cv1800b-adc.c
index bdc3e1326a9a..c6eed09acfcd 100644
--- a/drivers/iio/adc/sophgo-cv1800b-adc.c
+++ b/drivers/iio/adc/sophgo-cv1800b-adc.c
@@ -182,6 +182,8 @@ static int cv1800b_adc_probe(struct platform_device *pdev)
 		return PTR_ERR(saradc->regs);
 
 	saradc->irq = platform_get_irq_optional(pdev, 0);
+	if (saradc->irq < 0 && saradc->irq != -ENXIO)
+		return saradc->irq;
 	if (saradc->irq > 0) {
 		init_completion(&saradc->completion);
 		ret = devm_request_irq(dev, saradc->irq,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-13  7:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13  7:48 [PATCH] iio: adc: sophgo-saradc: Handle errors from optional IRQ lookup phucduc.bui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.