public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: jiawenwu@trustnetic.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	mengyuanlou@net-swift.com, horms@kernel.org,
	netdev@vger.kernel.org, edumazet@google.com, davem@davemloft.net,
	andrew+netdev@lunn.ch, pabeni@redhat.com
Subject: Re: [net-next,v1,3/7] net: wangxun: move reusable PCI driver ops functions into libwx
Date: Tue,  3 Feb 2026 18:22:37 -0800	[thread overview]
Message-ID: <20260204022237.1572988-1-kuba@kernel.org> (raw)
In-Reply-To: <20260203075759.5852-4-jiawenwu@trustnetic.com>

This is an AI-generated review of your patch. The human sending this
email says "Sending this out without checking since you have to
repost. Please note that the AI code review may be wrong especially
around defensive programming (which we recommend against)."

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
net: wangxun: move reusable PCI driver ops functions into libwx

This commit refactors PCI driver ops functions (suspend, resume, shutdown)
from ngbe_main.c into the shared libwx library, adding function pointers
wx->close_suspend() and adjusting wx->do_reset() to support this.

> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.c b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> --- a/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.c

[ ... ]

> +int wx_resume(struct pci_dev *pdev)
> +{
> +	struct net_device *netdev;
> +	struct wx *wx;
> +	u32 err;
> +
> +	wx = pci_get_drvdata(pdev);
> +	netdev = wx->netdev;
> +
> +	err = pci_enable_device_mem(pdev);
> +	if (err) {
> +		wx_err(wx, "Cannot enable PCI device from suspend\n");
> +		return err;
> +	}
> +	pci_set_master(pdev);
> +	device_wakeup_disable(&pdev->dev);
> +
> +	wx->do_reset(netdev, false);
> +	rtnl_lock();
> +
> +	err = wx_init_interrupt_scheme(wx);
> +	if (!err && netif_running(netdev))
> +		err = netdev->netdev_ops->ndo_open(netdev);
> +	if (!err)
> +		netif_device_attach(netdev);
> +	rtnl_unlock();
> +
> +	return 0;
> +}

Does wx_resume() need to return the error value stored in err?

The function assigns errors from wx_init_interrupt_scheme() and ndo_open()
to the err variable, and correctly skips netif_device_attach() when errors
occur, but then unconditionally returns 0 instead of returning err.

The early error handling for pci_enable_device_mem() correctly returns err,
but errors from the later calls are lost. This would tell the PM core that
resume succeeded when it actually failed.
-- 
pw-bot: cr

  reply	other threads:[~2026-02-04  2:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-03  7:57 [PATCH net-next v1 0/7] Wangxun improvement and new support Jiawen Wu
2026-02-03  7:57 ` [PATCH net-next v1 1/7] net: ngbe: move the WOL functions to libwx Jiawen Wu
2026-02-03 13:52   ` Andrew Lunn
2026-02-04  2:05     ` Jiawen Wu
2026-02-03  7:57 ` [PATCH net-next v1 2/7] net: ngbe: improve the reset flow Jiawen Wu
2026-02-03 13:56   ` Andrew Lunn
2026-02-04  2:20     ` Jiawen Wu
2026-02-03  7:57 ` [PATCH net-next v1 3/7] net: wangxun: move reusable PCI driver ops functions into libwx Jiawen Wu
2026-02-04  2:22   ` Jakub Kicinski [this message]
2026-02-04  6:12     ` [net-next,v1,3/7] " Jiawen Wu
2026-02-03  7:57 ` [PATCH net-next v1 4/7] net: txgbe: add power management support Jiawen Wu
2026-02-03  7:57 ` [PATCH net-next v1 5/7] net: wangxun: move ethtool_ops.set_channels into libwx Jiawen Wu
2026-02-03  7:57 ` [PATCH net-next v1 6/7] net: wangxun: add Tx timeout process Jiawen Wu
2026-02-03  7:57 ` [PATCH net-next v1 7/7] net: wangxun: add pcie error handler Jiawen Wu
2026-02-04  1:34   ` kernel test robot
2026-02-04  2:22   ` [net-next,v1,7/7] " Jakub Kicinski
2026-02-04  6:10     ` Jiawen Wu
2026-02-04 11:18   ` [PATCH net-next v1 7/7] " kernel test robot

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=20260204022237.1572988-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiawenwu@trustnetic.com \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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