From: luoxuanqiang <xuanqiang.luo@linux.dev>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: pch_gbe: Propagate device restart errors from resume
Date: Fri, 28 Aug 2026 21:13:44 +0800 [thread overview]
Message-ID: <f0b9caba-7851-444c-a242-44e4a35dd0e4@linux.dev> (raw)
In-Reply-To: <20260828105722.29952-1-pengpeng@iscas.ac.cn>
在 2026/8/28 18:57, Pengpeng Hou 写道:
> pch_gbe_up() can fail while allocating the IRQ or receive and transmit
> buffers. The resume path ignores that result and attaches the netdevice
> even though restart did not complete.
>
> Return the restart error, leave the netdevice detached, and restore the
> PHY and PCI device to the suspended resource state. pch_gbe_up()
> already frees allocations made before its failure.
>
> The issue was identified via static analysis and manually reviewed.
>
> Fixes: 77555ee72282 ("net: Add Gigabit Ethernet driver of Topcliff PCH")
>
> Assisted-by: LLM
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> index 88c5c52e0e38..737bdc9d569e 100644
> --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> @@ -2449,7 +2449,7 @@ static int pch_gbe_resume(struct device *device)
> struct net_device *netdev = pci_get_drvdata(pdev);
> struct pch_gbe_adapter *adapter = netdev_priv(netdev);
> struct pch_gbe_hw *hw = &adapter->hw;
> - u32 err;
> + int err;
>
> err = pci_enable_device(pdev);
> if (err) {
> @@ -2462,8 +2462,14 @@ static int pch_gbe_resume(struct device *device)
> /* Clear wake on lan control and status */
> pch_gbe_mac_set_wol_event(hw, 0);
>
> - if (netif_running(netdev))
> - pch_gbe_up(adapter);
> + if (netif_running(netdev)) {
> + err = pch_gbe_up(adapter);
> + if (err) {
> + pch_gbe_phy_power_down(hw);
The comment in pch_gbe_phy_power_down() explicitly says that the PHY
cannot be powered down when WoL is enabled or AMT is active.
Please do not call it unconditionally here.
Thanks,
Xuanqiang
> + pci_disable_device(pdev);
> + return err;
> + }
> + }
> netif_device_attach(netdev);
>
> return 0;
prev parent reply other threads:[~2026-08-28 13:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 10:57 Pengpeng Hou
2026-08-28 13:13 ` luoxuanqiang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f0b9caba-7851-444c-a242-44e4a35dd0e4@linux.dev \
--to=xuanqiang.luo@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pengpeng@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®