[PATCH AUTOSEL 6.18] net: ibm: emac: mal: fix unchecked platform_get_irq return values

From: Sasha Levin

Date: Mon Aug 31 2026 - 13:23:31 EST


From: Rosen Penev <rosenp@xxxxxxxxx>

[ Upstream commit 8084fc9292c2b9b148c9d19d50710c488652214c ]

platform_get_irq() returns a negative errno on failure.
Commit c4f5d0454cab5 moved the platform_get_irq() calls and explicitly
removed the error checks that were previously present, claiming
devm_request_irq() can handle it. However, a negative IRQ number
passed to devm_request_irq() fails with -EINVAL instead of
propagating the real error from platform_get_irq().

Restore the missing error checks with proper errno propagation.

Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>
Link: https://patch.msgid.link/20260603211734.30750-1-rosenp@xxxxxxxxx
Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

LLM Generated explanations, may be completely bogus:

Those background lookups are done and match what we already concluded:

- **Git log search:** No commit with subject “fix unchecked
platform_get_irq return values” in this tree. The only close hit was
`40af583d16465` (exynos5 `platform_get_irq` handling), which supports
the same error-propagation pattern but isn’t this fix.
- **b4 dig:** Returned nothing — expected, since the fix isn’t merged
here so there’s no commit hash to trace.

Verdict unchanged: **YES** for 6.18.44 — the regression from
`c4f5d0454cab5` is present and the patch should be backported.

drivers/net/ethernet/ibm/emac/mal.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c
index 35b93e6bcdf9f..74526002d52bd 100644
--- a/drivers/net/ethernet/ibm/emac/mal.c
+++ b/drivers/net/ethernet/ibm/emac/mal.c
@@ -635,6 +635,11 @@ static int mal_probe(struct platform_device *ofdev)
mal->txeob_irq = platform_get_irq(ofdev, 0);
mal->rxeob_irq = platform_get_irq(ofdev, 1);
mal->serr_irq = platform_get_irq(ofdev, 2);
+ if (mal->txeob_irq < 0 || mal->rxeob_irq < 0 || mal->serr_irq < 0) {
+ err = mal->txeob_irq < 0 ? mal->txeob_irq :
+ mal->rxeob_irq < 0 ? mal->rxeob_irq : mal->serr_irq;
+ goto fail2;
+ }

if (mal_has_feature(mal, MAL_FTR_COMMON_ERR_INT)) {
mal->txde_irq = mal->rxde_irq = mal->serr_irq;
@@ -643,6 +648,10 @@ static int mal_probe(struct platform_device *ofdev)
} else {
mal->txde_irq = platform_get_irq(ofdev, 3);
mal->rxde_irq = platform_get_irq(ofdev, 4);
+ if (mal->txde_irq < 0 || mal->rxde_irq < 0) {
+ err = mal->txde_irq < 0 ? mal->txde_irq : mal->rxde_irq;
+ goto fail2;
+ }
irqflags = 0;
hdlr_serr = mal_serr;
hdlr_txde = mal_txde;
--
2.53.0