[U-Boot] [PATCH v2] driver: net: ldpaa: Update priv->phydev after free()

Joe Hershberger joe.hershberger at gmail.com
Wed Feb 15 23:52:18 UTC 2017


On Wed, Feb 15, 2017 at 9:26 AM, Ashish Kumar <Ashish.Kumar at nxp.com> wrote:
> From: Prabhakar Kushwaha <prabhakar.kushwaha at nxp.com>
>
> Even after memory free of phydev, priv is still pointing to the
> obsolete address.
> So update priv->phydev as NULL after memory free.
>
> Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha at nxp.com>
> Signed-off-by: Ashish Kumar <Ashish.Kumar at nxp.com>

Please always Cc me on network changes.

> ---
> v2:
> Add signoff
>
>  drivers/net/ldpaa_eth/ldpaa_eth.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
> index 4e61700..f235b62 100644
> --- a/drivers/net/ldpaa_eth/ldpaa_eth.c
> +++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
> @@ -587,8 +587,10 @@ static void ldpaa_eth_stop(struct eth_device *net_dev)
>  #ifdef CONFIG_PHYLIB
>         if (priv->phydev && bus != NULL)
>                 phy_shutdown(priv->phydev);
> -       else
> +       else {
>                 free(priv->phydev);
> +               priv->phydev = NULL;
> +       }

This is strange. Why not just drop the free? It seems bad to delete
the phydev just because the mdio interface is not there, especially in
stop().

>  #endif
>
>         ldpaa_dpbp_free();
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list