Netdev List
 help / color / mirror / Atom feed
* [PATCH 0/4] net: broadcom: Improve IRQ error handling
@ 2026-08-20 11:14 phucduc.bui
  2026-08-20 11:14 ` [PATCH 1/4] net: bcmasp: Use platform_get_irq() for IRQ lookup phucduc.bui
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: phucduc.bui @ 2026-08-20 11:14 UTC (permalink / raw)
  To: Justin Chen, Florian Fainelli, Doug Berger
  Cc: Andrew Lunn, davem, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Broadcom internal kernel review list, linux-kernel, netdev,
	bui duc phuc

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

Hi all,

This series improves IRQ error handling in several Broadcom Ethernet
drivers by propagating IRQ lookup and request errors instead of
silently ignoring them.

The changes were found by manual code inspection and compile-tested
only.

Best regards,
Phuc

bui duc phuc (4):
  net: bcmasp: Use platform_get_irq() for IRQ lookup
  net: bcmasp: Propagate WoL IRQ errors from probe
  net: systemport: Propagate IRQ lookup errors
  net: bcmgenet: Propagate WoL IRQ errors

 drivers/net/ethernet/broadcom/asp2/bcmasp.c    | 17 +++++++++--------
 drivers/net/ethernet/broadcom/bcmsysport.c     | 12 ++++++++++--
 drivers/net/ethernet/broadcom/genet/bcmgenet.c |  8 +++++---
 3 files changed, 24 insertions(+), 13 deletions(-)

-- 
2.43.0


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

* [PATCH 1/4] net: bcmasp: Use platform_get_irq() for IRQ lookup
  2026-08-20 11:14 [PATCH 0/4] net: broadcom: Improve IRQ error handling phucduc.bui
@ 2026-08-20 11:14 ` phucduc.bui
  2026-08-20 11:14 ` [PATCH 2/4] net: bcmasp: Propagate WoL IRQ errors from probe phucduc.bui
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-08-20 11:14 UTC (permalink / raw)
  To: Justin Chen, Florian Fainelli, Doug Berger
  Cc: Andrew Lunn, davem, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Broadcom internal kernel review list, linux-kernel, netdev,
	bui duc phuc

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

The platform_get_irq_optional() function currently returns all negative
error values without distinguishing between the case where no IRQ is
available and actual errors occurring during the IRQ lookup.

Use platform_get_irq() instead, as it matches the existing error handling
by propagating any error encountered during the IRQ lookup.

Found by manual code inspection.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/net/ethernet/broadcom/asp2/bcmasp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
index 972474893a6b..d66a8bbd6e38 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
@@ -1094,7 +1094,7 @@ static int bcmasp_get_and_request_irq(struct bcmasp_priv *priv, int i)
 	struct platform_device *pdev = priv->pdev;
 	int irq, ret;
 
-	irq = platform_get_irq_optional(pdev, i);
+	irq = platform_get_irq(pdev, i);
 	if (irq < 0)
 		return irq;
 
-- 
2.43.0


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

* [PATCH 2/4] net: bcmasp: Propagate WoL IRQ errors from probe
  2026-08-20 11:14 [PATCH 0/4] net: broadcom: Improve IRQ error handling phucduc.bui
  2026-08-20 11:14 ` [PATCH 1/4] net: bcmasp: Use platform_get_irq() for IRQ lookup phucduc.bui
@ 2026-08-20 11:14 ` phucduc.bui
  2026-08-20 11:14 ` [PATCH 3/4] net: systemport: Propagate IRQ lookup errors phucduc.bui
  2026-08-20 11:14 ` [PATCH 4/4] net: bcmgenet: Propagate WoL IRQ errors phucduc.bui
  3 siblings, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-08-20 11:14 UTC (permalink / raw)
  To: Justin Chen, Florian Fainelli, Doug Berger
  Cc: Andrew Lunn, davem, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Broadcom internal kernel review list, linux-kernel, netdev,
	bui duc phuc

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

bcmasp_init_wol() currently ignores errors returned by
bcmasp_get_and_request_irq() and allows the probe to continue.

Return the error from bcmasp_init_wol() and propagate it to the probe
function instead of silently ignoring the failure to initialize the
WoL IRQ.

Found by manual code inspection.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/net/ethernet/broadcom/asp2/bcmasp.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
index d66a8bbd6e38..02e88adf4939 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
@@ -1106,21 +1106,20 @@ static int bcmasp_get_and_request_irq(struct bcmasp_priv *priv, int i)
 	return irq;
 }
 
-static void bcmasp_init_wol(struct bcmasp_priv *priv)
+static int bcmasp_init_wol(struct bcmasp_priv *priv)
 {
 	struct platform_device *pdev = priv->pdev;
-	struct device *dev = &pdev->dev;
 	int irq;
 
 	irq = bcmasp_get_and_request_irq(priv, 1);
-	if (irq < 0) {
-		dev_warn(dev, "Failed to init WoL irq: %d\n", irq);
-		return;
-	}
+	if (irq < 0)
+		return irq;
 
 	priv->wol_irq = irq;
 	priv->wol_irq_enabled_mask = 0;
 	device_set_wakeup_capable(&pdev->dev, 1);
+
+	return 0;
 }
 
 void bcmasp_enable_wol(struct bcmasp_intf *intf, bool en)
@@ -1321,7 +1320,9 @@ static int bcmasp_probe(struct platform_device *pdev)
 
 	bcmasp_core_init_filters(priv);
 
-	bcmasp_init_wol(priv);
+	ret = bcmasp_init_wol(priv);
+	if (ret)
+		goto err_clock_disable;
 
 	ports_node = of_find_node_by_name(dev->of_node, "ethernet-ports");
 	if (!ports_node) {
-- 
2.43.0


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

* [PATCH 3/4] net: systemport: Propagate IRQ lookup errors
  2026-08-20 11:14 [PATCH 0/4] net: broadcom: Improve IRQ error handling phucduc.bui
  2026-08-20 11:14 ` [PATCH 1/4] net: bcmasp: Use platform_get_irq() for IRQ lookup phucduc.bui
  2026-08-20 11:14 ` [PATCH 2/4] net: bcmasp: Propagate WoL IRQ errors from probe phucduc.bui
@ 2026-08-20 11:14 ` phucduc.bui
  2026-08-20 11:14 ` [PATCH 4/4] net: bcmgenet: Propagate WoL IRQ errors phucduc.bui
  3 siblings, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-08-20 11:14 UTC (permalink / raw)
  To: Justin Chen, Florian Fainelli, Doug Berger
  Cc: Andrew Lunn, davem, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Broadcom internal kernel review list, linux-kernel, netdev,
	bui duc phuc

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

Propagate the error codes returned by platform_get_irq() and
platform_get_irq_optional() instead of converting them to -EINVAL.

For the optional WoL IRQ, allow -ENXIO to indicate that the IRQ is not
available, but propagate any other error returned by the IRQ lookup.

Found by manual code inspection.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 4d06c6ba6641..2acaffccdb08 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2499,14 +2499,22 @@ static int bcm_sysport_probe(struct platform_device *pdev)
 	priv->num_rx_desc_words = params->num_rx_desc_words;
 
 	priv->irq0 = platform_get_irq(pdev, 0);
+	if (priv->irq0 < 0) {
+		ret = priv->irq0;
+		goto err_free_netdev;
+	}
 	if (!priv->is_lite) {
 		priv->irq1 = platform_get_irq(pdev, 1);
 		priv->wol_irq = platform_get_irq_optional(pdev, 2);
 	} else {
 		priv->wol_irq = platform_get_irq_optional(pdev, 1);
 	}
-	if (priv->irq0 <= 0 || (priv->irq1 <= 0 && !priv->is_lite)) {
-		ret = -EINVAL;
+	if (priv->irq1 < 0 && !priv->is_lite) {
+		ret = priv->irq1;
+		goto err_free_netdev;
+	}
+	if (priv->wol_irq < 0 && priv->wol_irq != -ENXIO) {
+		ret = priv->wol_irq;
 		goto err_free_netdev;
 	}
 
-- 
2.43.0


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

* [PATCH 4/4] net: bcmgenet: Propagate WoL IRQ errors
  2026-08-20 11:14 [PATCH 0/4] net: broadcom: Improve IRQ error handling phucduc.bui
                   ` (2 preceding siblings ...)
  2026-08-20 11:14 ` [PATCH 3/4] net: systemport: Propagate IRQ lookup errors phucduc.bui
@ 2026-08-20 11:14 ` phucduc.bui
  3 siblings, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-08-20 11:14 UTC (permalink / raw)
  To: Justin Chen, Florian Fainelli, Doug Berger
  Cc: Andrew Lunn, davem, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Broadcom internal kernel review list, linux-kernel, netdev,
	bui duc phuc

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

Propagate errors from platform_get_irq_optional() instead of only
handling -EPROBE_DEFER. Allow -ENXIO to indicate that the optional
WoL IRQ is not available.

Also propagate errors from devm_request_irq() instead of continuing
the probe when the WoL IRQ cannot be requested.

Found by manual code inspection.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index a2305e6428d1..c1c66a52efd0 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3993,7 +3993,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
 		goto err;
 	}
 	priv->wol_irq = platform_get_irq_optional(pdev, 2);
-	if (priv->wol_irq == -EPROBE_DEFER) {
+	if (priv->wol_irq < 0 && priv->wol_irq != -ENXIO) {
 		err = priv->wol_irq;
 		goto err;
 	}
@@ -4033,8 +4033,10 @@ static int bcmgenet_probe(struct platform_device *pdev)
 	if (priv->wol_irq > 0) {
 		err = devm_request_irq(&pdev->dev, priv->wol_irq,
 				       bcmgenet_wol_isr, 0, dev->name, priv);
-		if (!err)
-			device_set_wakeup_capable(&pdev->dev, 1);
+		if (err)
+			goto err;
+
+		device_set_wakeup_capable(&pdev->dev, 1);
 	}
 
 	/* Set the needed headroom to account for any possible
-- 
2.43.0


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

end of thread, other threads:[~2026-08-20 11:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20 11:14 [PATCH 0/4] net: broadcom: Improve IRQ error handling phucduc.bui
2026-08-20 11:14 ` [PATCH 1/4] net: bcmasp: Use platform_get_irq() for IRQ lookup phucduc.bui
2026-08-20 11:14 ` [PATCH 2/4] net: bcmasp: Propagate WoL IRQ errors from probe phucduc.bui
2026-08-20 11:14 ` [PATCH 3/4] net: systemport: Propagate IRQ lookup errors phucduc.bui
2026-08-20 11:14 ` [PATCH 4/4] net: bcmgenet: Propagate WoL IRQ errors phucduc.bui

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