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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Ashish Kumar-2
From: Prabhakar Kushwaha <[hidden email]>

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 <[hidden email]>
---
 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;
+ }
 #endif
 
  ldpaa_dpbp_free();
--
1.9.1

_______________________________________________
U-Boot mailing list
[hidden email]
http://lists.denx.de/mailman/listinfo/u-boot
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Joe Hershberger
On Wed, Feb 15, 2017 at 9:14 AM, Ashish Kumar <[hidden email]> wrote:
> From: Prabhakar Kushwaha <[hidden email]>
>
> 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 <[hidden email]>

Acked-by: Joe Hershberger <[hidden email]>
_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Loading...