[PATCH] net: davicom: Propagate wakeup IRQ errors

phucduc.bui@gmail.com posted 1 patch 1 month, 1 week ago
There is a newer version of this series
drivers/net/ethernet/davicom/dm9000.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
[PATCH] net: davicom: Propagate wakeup IRQ errors
Posted by phucduc.bui@gmail.com 1 month, 1 week ago
From: bui duc phuc <phucduc.bui@gmail.com>

The wakeup IRQ is optional, but errors from platform_get_irq_optional()
are currently ignored. Propagate errors from the IRQ lookup, except
-ENXIO which indicates that the optional IRQ is not available.

Also propagate errors from request_irq() and irq_set_irq_wake() instead
of continuing the probe after the wakeup IRQ setup fails.

Found by manual code inspection.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/net/ethernet/davicom/dm9000.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index b87eaf0c250c..904b859f0a63 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -1511,13 +1511,18 @@ dm9000_probe(struct platform_device *pdev)
 	}
 
 	db->irq_wake = platform_get_irq_optional(pdev, 1);
-	if (db->irq_wake >= 0) {
+	if (db->irq_wake < 0 && db->irq_wake != -ENXIO) {
+		ret = db->irq_wake;
+		goto out;
+	}
+	if (db->irq_wake > 0) {
 		dev_dbg(db->dev, "wakeup irq %d\n", db->irq_wake);
 
 		ret = request_irq(db->irq_wake, dm9000_wol_interrupt,
 				  IRQF_SHARED, dev_name(db->dev), ndev);
 		if (ret) {
 			dev_err(db->dev, "cannot get wakeup irq (%d)\n", ret);
+			goto out;
 		} else {
 
 			/* test to see if irq is really wakeup capable */
@@ -1525,6 +1530,7 @@ dm9000_probe(struct platform_device *pdev)
 			if (ret) {
 				dev_err(db->dev, "irq %d cannot set wakeup (%d)\n",
 					db->irq_wake, ret);
+				goto out;
 			} else {
 				irq_set_irq_wake(db->irq_wake, 0);
 				db->wake_supported = 1;
-- 
2.43.0
Re: [PATCH] net: davicom: Propagate wakeup IRQ errors
Posted by Paolo Abeni 1 month, 1 week ago
On 8/20/26 1:15 PM, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> The wakeup IRQ is optional, but errors from platform_get_irq_optional()
> are currently ignored. Propagate errors from the IRQ lookup, except
> -ENXIO which indicates that the optional IRQ is not available.
> 
> Also propagate errors from request_irq() and irq_set_irq_wake() instead
> of continuing the probe after the wakeup IRQ setup fails.
> 
> Found by manual code inspection.
> 
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
## Form letter - net-next-closed

We have already submitted our pull request with net-next material for v7.3,
and therefore net-next is closed for new drivers, features, code refactoring
and optimizations. We are currently accepting bug fixes only.

Please repost when net-next reopens after Aug 31st.

RFC patches sent for review only are obviously welcome at any time.

See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle