From: Jakub Kicinski <kuba@kernel.org>
To: justin.chen@broadcom.com
Cc: Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, pabeni@redhat.com, edumazet@google.com,
davem@davemloft.net, linux@armlinux.org.uk, hkallweit1@gmail.com,
andrew@lunn.ch, bcm-kernel-feedback-list@broadcom.com
Subject: Re: [PATCH net-next] net: phy: broadcom: Save PHY counters during suspend
Date: Wed, 29 Apr 2026 16:22:31 -0700 [thread overview]
Message-ID: <20260429232231.2193106-1-kuba@kernel.org> (raw)
In-Reply-To: <20260428212424.1828999-1-justin.chen@broadcom.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
net: phy: broadcom: Save PHY counters during suspend
The PHY counters can be lost if the PHY is reset during suspend. We
need to save the values into the shadow counters or the accounting
will be incorrect over multiple suspend and resume cycles.
> diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c
> --- a/drivers/net/phy/bcm7xxx.c
> +++ b/drivers/net/phy/bcm7xxx.c
> @@ -733,6 +733,7 @@ static int bcm7xxx_config_init(struct phy_device *phydev)
> */
> static int bcm7xxx_suspend(struct phy_device *phydev)
> {
> + struct bcm7xxx_phy_priv *priv = phydev->priv;
> int ret;
[ ... ]
> unsigned int i;
>
> + mutex_lock(&phydev->lock);
> + bcm_phy_update_stats_shadow(phydev, priv->stats);
Does this cause a NULL pointer dereference for 40nm PHYs?
The bcm7xxx_suspend() function is used as the suspend callback for PHY
models defined by the BCM7XXX_40NM_EPHY() macro (like BCM7346, BCM7362,
and BCM7425).
Unlike the 28nm and 16nm PHY macros which assign a probe callback to
allocate phydev->priv, the BCM7XXX_40NM_EPHY() macro does not appear to
define a probe callback. This would leave phydev->priv as NULL and cause a
crash when trying to access priv->stats here.
> + mutex_unlock(&phydev->lock);
>
> for (i = 0; i < ARRAY_SIZE(bcm7xxx_suspend_cfg); i++) {
> ret = phy_write(phydev,
--
pw-bot: cr
prev parent reply other threads:[~2026-04-29 23:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 21:24 [PATCH net-next] net: phy: broadcom: Save PHY counters during suspend Justin Chen
2026-04-28 21:58 ` Florian Fainelli
2026-04-29 23:22 ` Jakub Kicinski [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=20260429232231.2193106-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=justin.chen@broadcom.com \
--cc=linux@armlinux.org.uk \
--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