All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: kr494167@gmail.com
Cc: linux-phy@lists.infradead.org, olteanv@gmail.com,
	vkoul@kernel.org, neil.armstrong@linaro.org
Subject: Re: [PATCH] phy: fsl-lynx-10g: propagate PCVT enable errors
Date: Tue, 21 Jul 2026 10:20:11 +0000	[thread overview]
Message-ID: <20260721102011.B86611F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260720101906.80584-1-kr494167@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Propagating the PCVT enable error without updating or invalidating `lane->mode` desynchronizes the hardware and software states, breaking subsequent recovery attempts by the caller.
--

--- Patch [1]: [PATCH] phy: fsl-lynx-10g: propagate PCVT enable errors ---
commit 3b0f3762ed7624d800a9c9cc065f1db5078536b5
Author: surendra <kr494167@gmail.com>

phy: fsl-lynx-10g: propagate PCVT enable errors

This patch updates lynx_10g_set_mode() to propagate errors from
lynx_10g_lane_enable_pcvt(). It aborts the mode change if the protocol
converter fails to enable, returning the error to the caller without
updating the tracked lane mode.

> diff --git a/drivers/phy/freescale/phy-fsl-lynx-10g.c b/drivers/phy/freescale/phy-fsl-lynx-10g.c
> index 38def160ef1aa..9740b08700c48 100644
> --- a/drivers/phy/freescale/phy-fsl-lynx-10g.c
> +++ b/drivers/phy/freescale/phy-fsl-lynx-10g.c
> @@ -1231,7 +1231,9 @@ static int lynx_10g_set_mode(struct phy *phy, enum phy_mode mode, int submode)
>  
>  	lynx_10g_lane_change_proto_conf(lane, lane_mode);
>  	lynx_10g_lane_remap_pll(lane, lane_mode);
> -	WARN_ON(lynx_10g_lane_enable_pcvt(lane, lane_mode));
> +	err = lynx_10g_lane_enable_pcvt(lane, lane_mode);
> +	if (err)
> +		goto out;

[Severity: High]
If lynx_10g_lane_enable_pcvt() fails here, we jump to out and skip updating
lane->mode. However, lynx_10g_lane_change_proto_conf() and
lynx_10g_lane_remap_pll() have already modified the hardware registers for
the new mode.

If the caller handles this error by attempting to restore the original mode,
lynx_10g_set_mode() will evaluate this check earlier in the function:

        if (lane_mode == lane->mode)
                return 0;

Because lane->mode still holds the old mode, this will return 0 immediately
without reverting the hardware changes. Will this leave the hardware and
software states desynchronized and prevent the caller from successfully
recovering?

>  
>  	lane->mode = lane_mode;
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260720101906.80584-1-kr494167@gmail.com?part=1

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

      parent reply	other threads:[~2026-07-21 10:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 10:19 [PATCH] phy: fsl-lynx-10g: propagate PCVT enable errors kr494167
2026-07-20 10:19 ` kr494167
2026-07-20 12:14 ` Breno Leitao
2026-07-20 12:14   ` Breno Leitao
2026-07-20 12:16 ` Vladimir Oltean
2026-07-20 12:16   ` Vladimir Oltean
2026-07-21 10:20 ` sashiko-bot [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=20260721102011.B86611F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kr494167@gmail.com \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.