From a5fe87e829487cb5589afba3b5d8c3adff3b077d Mon Sep 17 00:00:00 2001 From: Prabhakar Kushwaha Date: Wed, 15 Feb 2017 20:56:03 +0530 Subject: [PATCH] driver: net: ldpaa: Update priv->phydev after free() 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 Signed-off-by: Ashish Kumar Acked-by: Joe Hershberger --- 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 4e61700d5d..f235b622b6 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(); -- 2.39.5