diff mbox series

[09/12] net: ti: am65-cpsw-nuss: Don't cache disabled port ID

Message ID 20210510143613.16512-10-vigneshr@ti.com
State Accepted
Commit 2411e85b99293de8701c42d52b31249f0232622c
Delegated to: Lokesh Vutla
Headers show
Series AM64x: DMA and ethernet support | expand

Commit Message

Raghavendra, Vignesh May 10, 2021, 2:36 p.m. UTC
Currently driver may end up caching disabled port ID as active
interface. Fix this by bailing out earlier in case port is marked
disabled in the DT.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 drivers/net/ti/am65-cpsw-nuss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ramon Fried May 15, 2021, 7:50 p.m. UTC | #1
On Mon, May 10, 2021 at 5:37 PM Vignesh Raghavendra <vigneshr@ti.com> wrote:
>
> Currently driver may end up caching disabled port ID as active
> interface. Fix this by bailing out earlier in case port is marked
> disabled in the DT.
>
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> ---
>  drivers/net/ti/am65-cpsw-nuss.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c
> index 9f11ce63b9..3534a6d807 100644
> --- a/drivers/net/ti/am65-cpsw-nuss.c
> +++ b/drivers/net/ti/am65-cpsw-nuss.c
> @@ -719,11 +719,11 @@ static int am65_cpsw_probe_cpsw(struct udevice *dev)
>                 if (!port_id)
>                         continue;
>
> -               priv->port_id = port_id;
>                 cpsw_common->ports[port_id].disabled = disabled;
>                 if (disabled)
>                         continue;
>
> +               priv->port_id = port_id;
>                 ret = am65_cpsw_ofdata_parse_phy(dev, node);
>                 if (ret)
>                         goto out;
> --
> 2.31.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c
index 9f11ce63b9..3534a6d807 100644
--- a/drivers/net/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ti/am65-cpsw-nuss.c
@@ -719,11 +719,11 @@  static int am65_cpsw_probe_cpsw(struct udevice *dev)
 		if (!port_id)
 			continue;
 
-		priv->port_id = port_id;
 		cpsw_common->ports[port_id].disabled = disabled;
 		if (disabled)
 			continue;
 
+		priv->port_id = port_id;
 		ret = am65_cpsw_ofdata_parse_phy(dev, node);
 		if (ret)
 			goto out;