[PATCH 1/2] net: dsa: pass CPU port fixed PHY to .port_disable

Tim Harvey tharvey at gateworks.com
Tue Sep 28 17:10:51 CEST 2021


On Sat, Sep 18, 2021 at 4:50 AM Vladimir Oltean <vladimir.oltean at nxp.com> wrote:
>
> While adding the logic for DSA to register a fixed-link PHY for the CPU
> port, I forgot to pass it to the .port_disable method too, just
> .port_enable.
>
> Bug had no impact for felix_switch.c, due to the phy argument not being
> used, but ksz9477.c does use it => NULL pointer dereference.
>
> Fixes: fc054d563bfb ("net: Introduce DSA class for Ethernet switches")
> Signed-off-by: Vladimir Oltean <vladimir.oltean at nxp.com>
> ---
>  net/dsa-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/dsa-uclass.c b/net/dsa-uclass.c
> index 9b8ae1e82b92..d1c6c78acd6c 100644
> --- a/net/dsa-uclass.c
> +++ b/net/dsa-uclass.c
> @@ -100,7 +100,7 @@ static void dsa_port_stop(struct udevice *pdev)
>
>                 port_pdata = dev_get_parent_plat(pdev);
>                 ops->port_disable(dev, port_pdata->index, port_pdata->phy);
> -               ops->port_disable(dev, priv->cpu_port, NULL);
> +               ops->port_disable(dev, priv->cpu_port, priv->cpu_port_fixed_phy);
>         }
>
>         eth_get_ops(master)->stop(master);
> --
> 2.25.1
>

Turns out ksz9477.c only used it if debug was enabled as right after
the debug print it would return for cpu port.

Tested on imx8mm-venice-gw7901 with ksz9477 switch.

Tested-By: Tim Harvey <tharvey at gateworks.com>


More information about the U-Boot mailing list