Skip to content

can: don't discard the platform_get_irq() error in probe

Chaosheng Qu linux-can lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4can: sun4i_can: don't discard the IRQ lookup error in probedrivers/net/can/sun4i_can.c+1 -10 replies
2/4can: at91_can: don't discard the IRQ lookup error in probedrivers/net/can/at91_can.c+7 -20 replies
3/4can: janz-ican3: don't discard the IRQ lookup error in probedrivers/net/can/janz-ican3.c+1 -10 replies
4/4can: ifi_canfd: don't discard the IRQ lookup error in probedrivers/net/can/ifi_canfd/ifi_canfd.c+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net-next 0/4] can: don't discard the platform_get_irq() error in probe

Four CAN platform drivers collapse every failure of platform_get_irq() into a fixed error code:

    sun4i_can    -ENODEV
    at91_can     -ENODEV  (also tests irq <= 0, which cannot happen)
    janz-ican3   -ENODEV
    ifi_canfd    -EINVAL

sun4i_can, at91_can and ifi_canfd match through an of_match_table, so of_irq_get() returns -EPROBE_DEFER while the interrupt controller has not been probed. The probes overwrite it and the driver core stops retrying, leaving the device unbound even though the interrupt controller appears later.

janz-ican3 is different. The device is an MFD child of janz-cmodio, which takes the interrupt from the carrier board's PCI device, and the driver has neither an of_match_table nor an ACPI match, so it cannot see -EPROBE_DEFER. Its commit message says so: that one is about the probe not inventing an error code for a lookup that failed for another reason.

The patches return the lookup error unchanged, which is what the neighbouring CAN platform drivers do, e.g. commit 057bd6168d98 ("can:
cc770: don't discard the IRQ lookup error in probe") and, from 2023, commit 53b8d2be4d71 ("can: flexcan: fix the return value handle for platform_get_irq()"). The 2023 sweep covered flexcan and c_can and missed these four.

at91_can additionally has to split its combined lookup, because the memory resource and the interrupt are currently checked in one condition that returns -ENODEV for both. The memory resource keeps -ENODEV.

The only visible change is the error code for a device tree without an
interrupt: -ENXIO instead of -ENODEV or -EINVAL. The driver core treats both as a failed probe.

All four apply with git am to mkl/linux-can-next testing and build without new warnings on x86_64 with CAN_SUN4I, CAN_AT91, CAN_JANZ_ICAN3 and CAN_IFI_CANFD enabled; checkpatch.pl --strict is clean. None of the four controllers is available here, so this is build tested only.

Assisted-by LLM

Chaosheng Qu (4):
can: sun4i_can: don't discard the IRQ lookup error in probe
can: at91_can: don't discard the IRQ lookup error in probe
can: janz-ican3: don't discard the IRQ lookup error in probe
can: ifi_canfd: don't discard the IRQ lookup error in probe

 drivers/net/can/at91_can.c            | 9 +++++++--
 drivers/net/can/ifi_canfd/ifi_canfd.c | 2 +-
 drivers/net/can/janz-ican3.c          | 2 +-
 drivers/net/can/sun4i_can.c           | 2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)
Signature · 1 line
2.43.0