[PATCH net v2 1/2] net: ngbe: propagate resume errors to the PM core

From: Zhang Yunfei

Date: Tue Sep 22 2026 - 06:13:16 EST


ngbe_resume() declares err as u32 and unconditionally returns 0, so
failures of wx_init_interrupt_scheme() or ngbe_open() are silently
swallowed, and the return value of ngbe_reset_hw() is ignored
entirely. The device stays in netif_device_detach() state with a
broken interrupt scheme, the PM core is told the resume succeeded,
and the netdev never appears in the networking stack again: the
reset task also bails out early on the missing
netif_device_present() check, so the device cannot self-heal.

Fix the type to int and propagate the errors instead, making the
whole tail of the resume path consistent with the
pci_enable_device_mem() failure path at the top, which already
propagates its error. If the hardware reset fails, the remaining
resume steps cannot succeed, so return early instead of continuing
with a broken device. A failed resume is then reported to the PM
core, which records and logs the failure, instead of being silently
swallowed.

Fixes: 6963e463256e ("net: ngbe: add Wake on Lan support")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Zhang Yunfei <zhangyunfei1@xxxxxxxxxx>
---

Changes in v2:
- also propagate the ngbe_reset_hw() failure, so the whole tail of
ngbe_resume() reports errors to the PM core;
- drop the inaccurate "device can be re-probed" claim: the PM core
records and logs the failure, there is no re-probe.

drivers/net/ethernet/wangxun/ngbe/ngbe_main.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
index 855dc963c610..e8cabcc84a41 100644
--- a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
+++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
@@ -954,7 +954,7 @@ static int ngbe_resume(struct pci_dev *pdev)
{
struct net_device *netdev;
struct wx *wx;
- u32 err;
+ int err;

wx = pci_get_drvdata(pdev);
netdev = wx->netdev;
@@ -968,7 +968,9 @@ static int ngbe_resume(struct pci_dev *pdev)
pci_set_master(pdev);
device_wakeup_disable(&pdev->dev);

- ngbe_reset_hw(wx);
+ err = ngbe_reset_hw(wx);
+ if (err)
+ return err;
rtnl_lock();
err = wx_init_interrupt_scheme(wx);
if (!err && netif_running(netdev))
@@ -977,7 +979,7 @@ static int ngbe_resume(struct pci_dev *pdev)
netif_device_attach(netdev);
rtnl_unlock();

- return 0;
+ return err;
}

static struct pci_driver ngbe_driver = {
--
2.25.1