πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Marc Kleine-Budde Wed, 18 Nov 2026 09:11
[PATCH net-next 07/12] can: at91_can: don't discard the IRQ lookup error in probe
#18408
Author: Marc Kleine-Budde
Date: Wed, 18 Nov 2026 09:11
65 lines
11155 bytes
From: Chaosheng Qu <chaosheng.qu.linux@gmail.com>

at91_can_probe() looks up the memory resource and the interrupt together
and collapses both failures into -ENODEV:

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	irq = platform_get_irq(pdev, 0);
	if (!res || irq <= 0) {
		err = -ENODEV;
		goto exit_put;
	}

The driver matches through an of_match_table, so of_irq_get() returns
-EPROBE_DEFER while the interrupt controller has not been probed. The
probe overwrites it and the driver core stops retrying, leaving the
device unbound even though the interrupt controller appears later.

The irq <= 0 test also covers a 0 return, which platform_get_irq() never
produces; it warns and returns -EINVAL instead.

Split the two lookups: the memory resource keeps -ENODEV, the interrupt
returns the lookup error unchanged, as the neighbouring CAN platform
drivers do, e.g. previous commit ("can: cc770: don't discard the IRQ lookup
error in probe"). This also drops an IRQ lookup that cannot succeed when
the memory resource is missing.

A device tree without an interrupt now reports -ENXIO rather than
-ENODEV; the driver core treats both as a failed probe.

Build tested on x86_64.

Signed-off-by: Chaosheng Qu <chaosheng.qu.linux@gmail.com>
Link: https://patch.msgid.link/303815792800553c34842147941cab083823c212.1792118040.git.chaosheng.qu.linux@gmail.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/at91_can.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 58da323f14d7..3977de761636 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1069,12 +1069,17 @@ static int at91_can_probe(struct platform_device *pdev)
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	irq = platform_get_irq(pdev, 0);
-	if (!res || irq <= 0) {
+	if (!res) {
 		err = -ENODEV;
 		goto exit_put;
 	}
 
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		err = irq;
+		goto exit_put;
+	}
+
 	if (!request_mem_region(res->start,
 				resource_size(res),
 				pdev->name)) {
-- 
2.53.0
Re: [PATCH net-next 07/12] can: at91_can: don't discard the IRQ lookup error in probe
#19080
Author: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 09:54
65 lines
10462 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message of "can: at91_can: don't discard the IRQ
  lookup error in probe" gives a real deferred-probe failure as the…

--

can: at91_can: don't discard the IRQ lookup error in probe

This commit splits the memory resource and IRQ lookups in
at91_can_probe(). A missing memory resource still returns -ENODEV, and the
error from platform_get_irq() is now passed through unchanged instead of
being collapsed into -ENODEV.

Link: https://patch.msgid.link/303815792800553c34842147941cab083823c212.1792118040.git.chaosheng.qu.linux@gmail.com

> The driver matches through an of_match_table, so of_irq_get() returns
> -EPROBE_DEFER while the interrupt controller has not been probed. The
> probe overwrites it and the driver core stops retrying, leaving the
> device unbound even though the interrupt controller appears later.

[Severity: Low]
Can this deferral scenario happen with any in-tree user of this driver?

Every in-tree CAN node for this driver inherits interrupt-parent = <&aic>
from the root of at91sam9263.dtsi, at91sam9x5.dtsi, sama5d3.dtsi and
sam9x60.dtsi.

The controllers behind <&aic> all register through IRQCHIP_DECLARE:

drivers/irqchip/irq-atmel-aic.c:
    IRQCHIP_DECLARE(at91rm9200_aic, "atmel,at91rm9200-aic", aic_of_init);

drivers/irqchip/irq-atmel-aic5.c:
    IRQCHIP_DECLARE(sama5d3_aic5, "atmel,sama5d3-aic", sama5d3_aic5_of_init);
    ...
    IRQCHIP_DECLARE(sam9x60_aic5, "microchip,sam9x60-aic", sam9x60_aic5_of_init);

That means of_irq_init() sets them up from init_IRQ(), well before any
platform driver probes. So irq_find_host() in of_irq_get() should always
find the domain, and the -EPROBE_DEFER path is not reachable for this
device. The legacy non-DT path through platform_get_device_id() never
calls of_irq_get() at all.

The change itself looks fine as a consistency and robustness cleanup.
The sibling commit "can: cc770: don't discard the IRQ lookup error in
probe" has this caveat:

    This is a robustness and consistency cleanup, this issue has not been
    seen on real hardware

The commit "can: janz-ican3: don't discard the IRQ lookup error in probe"
also says it does not fix a deferred probe.

Could this message carry a similar note? As written, it reads like a fix
for an observed unbound device, and that could affect stable or AUTOSEL
backport decisions.

-- 
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118092955.1283165-2-mkl%40pengutronix.de
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads