[PATCH] phy: fsl-lynx-10g: propagate PCVT enable errors

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Jul 21 03:20:11 PDT 2026


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 at 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



More information about the linux-phy mailing list