Netdev List
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
	andrew+netdev@lunn.ch, horms@kernel.org, o.rempel@pengutronix.de,
	kory.maincent@bootlin.com, haiyangz@microsoft.com,
	andrew@lunn.ch, chleroy@kernel.org
Subject: Re: [PATCH net 04/10] ethtool: pse-pd: fix missing ethnl_ops_complete()
Date: Tue, 26 May 2026 18:51:29 +0200	[thread overview]
Message-ID: <d16bf6d2-94b3-4e7f-b71e-04215dc66965@bootlin.com> (raw)
In-Reply-To: <20260526153533.2779187-5-kuba@kernel.org>

Hi,

On 5/26/26 17:35, Jakub Kicinski wrote:
> pse_prepare_data() is missing ethnl_ops_complete() if
> ethnl_req_get_phydev() returned an error. Move getting
> phydev up so that we don't have to worry about this
> (similar order to linkstate_prepare_data()).
> 
> Note that phydev may still be NULL (this is checked in
> pse_get_pse_attributes()), the goal isn't really to avoid
> the _begin() / _complete() calls, only to simplify the error
> handling.
> 
> While at it propagate the original error. Why this code
> overrides the error with -ENODEV but !phydev generates
> -EOPNOTSUPP is unclear to me...

The logic is that ethnl_req_get_phydev() may return -ENODEV,
meaning "you passed a phy index for a PHY that doesn't
exist", which is different than "there's no PHY, setting PSE-PD
params isn't supported then."

But there's no real sense overriding the phydev ERR_PTR with the same
value :) Your fix should be fine :) Thanks for this !

> 
> Fixes: 31748765bed3 ("net: ethtool: pse-pd: Target the command to the requested PHY")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime

> ---
> CC: o.rempel@pengutronix.de
> CC: kory.maincent@bootlin.com
> CC: andrew@lunn.ch
> CC: maxime.chevallier@bootlin.com
> CC: chleroy@kernel.org
> ---
>   net/ethtool/pse-pd.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/net/ethtool/pse-pd.c b/net/ethtool/pse-pd.c
> index 2eb9bdc2dcb9..757c9e0cc856 100644
> --- a/net/ethtool/pse-pd.c
> +++ b/net/ethtool/pse-pd.c
> @@ -62,14 +62,14 @@ static int pse_prepare_data(const struct ethnl_req_info *req_base,
>   	struct phy_device *phydev;
>   	int ret;
>   
> -	ret = ethnl_ops_begin(dev);
> -	if (ret < 0)
> -		return ret;
> -
>   	phydev = ethnl_req_get_phydev(req_base, tb, ETHTOOL_A_PSE_HEADER,
>   				      info->extack);
>   	if (IS_ERR(phydev))
> -		return -ENODEV;
> +		return PTR_ERR(phydev);
> +
> +	ret = ethnl_ops_begin(dev);
> +	if (ret < 0)
> +		return ret;
>   
>   	ret = pse_get_pse_attributes(phydev, info->extack, data);
>   


  reply	other threads:[~2026-05-26 16:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 15:35 [PATCH net 00/10] ethtool: more bug fixes Jakub Kicinski
2026-05-26 15:35 ` [PATCH net 01/10] ethtool: coalesce: cap profile updates at NET_DIM_PARAMS_NUM_PROFILES Jakub Kicinski
2026-05-26 17:41   ` Maxime Chevallier
2026-05-26 15:35 ` [PATCH net 02/10] ethtool: tsconfig: fix reply error handling Jakub Kicinski
2026-05-26 16:04   ` Vadim Fedorenko
2026-05-26 15:35 ` [PATCH net 03/10] ethtool: linkstate: fix unbalanced ethnl_ops_complete() on PHY lookup error Jakub Kicinski
2026-05-26 16:41   ` Maxime Chevallier
2026-05-26 15:35 ` [PATCH net 04/10] ethtool: pse-pd: fix missing ethnl_ops_complete() Jakub Kicinski
2026-05-26 16:51   ` Maxime Chevallier [this message]
2026-05-26 15:35 ` [PATCH net 05/10] ethtool: tsconfig: " Jakub Kicinski
2026-05-26 16:06   ` Vadim Fedorenko
2026-05-26 15:35 ` [PATCH net 06/10] ethtool: tsinfo: fix uninitialized stats on the by-PHC path Jakub Kicinski
2026-05-26 17:23   ` Maxime Chevallier
2026-05-26 22:51     ` Jakub Kicinski
2026-05-26 15:35 ` [PATCH net 07/10] ethtool: tsinfo: don't pass ERR_PTR to genlmsg_cancel on prepare failure Jakub Kicinski
2026-05-26 17:46   ` Maxime Chevallier
2026-05-26 15:35 ` [PATCH net 08/10] ethtool: strset: fix header attribute index in ethnl_req_get_phydev() Jakub Kicinski
2026-05-26 17:15   ` Maxime Chevallier
2026-05-26 15:35 ` [PATCH net 09/10] ethtool: eeprom: add missing ethnl_ops_begin() / _complete() during fallback Jakub Kicinski
2026-05-26 17:13   ` Maxime Chevallier
2026-05-26 15:35 ` [PATCH net 10/10] ethtool: eeprom: add more safeties to EEPROM Netlink fallback Jakub Kicinski
2026-05-26 17:30   ` Maxime Chevallier

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=d16bf6d2-94b3-4e7f-b71e-04215dc66965@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=chleroy@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=haiyangz@microsoft.com \
    --cc=horms@kernel.org \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --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