Netdev List
 help / color / mirror / Atom feed
* [PATCHv2 net] net: ibm: emac: mal: fix unchecked platform_get_irq return values
@ 2026-06-03 21:17 Rosen Penev
  2026-06-08 18:54 ` Simon Horman
  2026-06-09  0:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Rosen Penev @ 2026-06-03 21:17 UTC (permalink / raw)
  To: netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rosen Penev, open list

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.

Fixes: c4f5d0454cab5 ("net: ibm: emac: mal: move irq maps down")
Assisted-by: Opencode:Big-Pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 v2: remove error messages. platform_get_irq writes its own.
 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 7d70056e9008..83dd7f99d8d5 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.54.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCHv2 net] net: ibm: emac: mal: fix unchecked platform_get_irq return values
  2026-06-03 21:17 [PATCHv2 net] net: ibm: emac: mal: fix unchecked platform_get_irq return values Rosen Penev
@ 2026-06-08 18:54 ` Simon Horman
  2026-06-09  0:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2026-06-08 18:54 UTC (permalink / raw)
  To: Rosen Penev
  Cc: netdev, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, open list

On Wed, Jun 03, 2026 at 02:17:34PM -0700, Rosen Penev wrote:
> 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.
> 
> Fixes: c4f5d0454cab5 ("net: ibm: emac: mal: move irq maps down")
> Assisted-by: Opencode:Big-Pickle
> Signed-off-by: Rosen Penev <rosenp@gmail.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHv2 net] net: ibm: emac: mal: fix unchecked platform_get_irq return values
  2026-06-03 21:17 [PATCHv2 net] net: ibm: emac: mal: fix unchecked platform_get_irq return values Rosen Penev
  2026-06-08 18:54 ` Simon Horman
@ 2026-06-09  0:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-06-09  0:30 UTC (permalink / raw)
  To: Rosen Penev
  Cc: netdev, andrew+netdev, davem, edumazet, kuba, pabeni,
	linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  3 Jun 2026 14:17:34 -0700 you wrote:
> 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().
> 
> [...]

Here is the summary with links:
  - [PATCHv2,net] net: ibm: emac: mal: fix unchecked platform_get_irq return values
    https://git.kernel.org/netdev/net-next/c/8084fc9292c2

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-09  0:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-03 21:17 [PATCHv2 net] net: ibm: emac: mal: fix unchecked platform_get_irq return values Rosen Penev
2026-06-08 18:54 ` Simon Horman
2026-06-09  0:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox