driver: net: ldpaa: Update priv->phydev after free()
PATCH v2 1/1 driver: net: ldpaa: Update priv->phydev after free()
From: Prabhakar Kushwaha <[email protected]>
Even after memory free of phydev, priv is still pointing to the obsolete address.
So update priv->phydev as NULL after memory free.
---
v2:
Add signoff
drivers/net/ldpaa_eth/ldpaa_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ldpaa_eth/ldpaa_eth.c +3 -1
@@ -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 ();
Signature · 1 line
1.9.1
PATCH v2 1/1 driver: net: ldpaa: Update priv->phydev after free()
Quoted 8 lines · Ashish Kumar
From: Prabhakar Kushwaha <[email protected]>
Even after memory free of phydev, priv is still pointing to the obsolete address.
So updatepriv->phydevas NULL after memory free.Signed-off-by Prabhakar Kushwaha <[email protected]>Signed-off-by Ashish Kumar <[email protected]>
Please always Cc me on network changes.
Quoted 12 lines
---
v2:
Add signoffdrivers/net/ldpaa_eth/ldpaa_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/ldpaa_eth/ldpaa_eth.c +0
-0
drivers/net/ldpaa_eth/ldpaa_eth.c static void ldpaa_eth_stop(struct eth_device *net_dev) · line 593
Quoted 8 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +3
-1@@ -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().
Quoted 10 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +0
-1#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
PATCH v2 1/1 driver: net: ldpaa: Update priv->phydev after free()
Hello Joe,
Please see inline.
Regards
Ashish
-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at gmail.com]
Sent: Thursday, February 16, 2017 5:22 AM
To: Ashish Kumar <[email protected]>
Cc: u-boot <[email protected]>
Subject: Re: [U-Boot] [PATCH v2] driver: net: ldpaa: Update priv->phydev after free()
Quoted 8 lines · Ashish Kumar
From: Prabhakar Kushwaha <[email protected]>
Even after memory free of phydev, priv is still pointing to the obsolete address.
So updatepriv->phydevas NULL after memory free.Signed-off-by Prabhakar Kushwaha <[email protected]>Signed-off-by Ashish Kumar <[email protected]>
Please always Cc me on network changes.
Quoted 13 lines
---
v2:
Add signoffdrivers/net/ldpaa_eth/ldpaa_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/ldpaa_eth/ldpaa_eth.c +0
-0
drivers/net/ldpaa_eth/ldpaa_eth.c static void ldpaa_eth_stop(struct eth_device · line 593
Quoted 8 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +3
-1@@ -587,8 +587,10 @@ static void ldpaa_eth_stop(struct eth_device *net_dev) #ifdef CONFIG_PHYLIBif (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().
[Ashish Kumar] To keep the flow consistent of XFI(which is phy-less) to other phy based interface, in ldpaa_eth_open there are some dummy allocation, which is freed in the end in stop().
if ((bus == NULL) &&
(enet_if == PHY_INTERFACE_MODE_XGMII)) {
printf("%s %s %d\n",__FILE__, __func__, __LINE__);
priv->phydev = (struct phy_device *)
malloc(sizeof(struct phy_device));
memset(priv->phydev, 0, sizeof(struct phy_device));
priv->phydev->speed = SPEED_10000;
priv->phydev->link = 1;
priv->phydev->duplex = DUPLEX_FULL;
}Quoted 10 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +0
-1#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
PATCH v2 1/1 driver: net: ldpaa: Update priv->phydev after free()
Hi Guys,
I want to understand cpu release command of u-boot and its implementation.
When we do cpu release <Cpu no> the satndalone application (may be kernel or so) starts running on particular processor. How does it happens ? Can anyone pls let me know this logic and point me in U -boot code for this function ?
BR/Krish
Quoted 82 lines · Ashish Kumar
Hello Joe,
Please see inline.
Regards
Ashish-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at gmail.com]
Sent: Thursday, February 16, 2017 5:22 AM
To: Ashish Kumar <[email protected]>
Cc: u-boot <[email protected]>
Subject: Re: [U-Boot] [PATCH v2] driver: net: ldpaa: Updatepriv->phydevafterfree()Quoted 8 lines · Ashish Kumar
From: Prabhakar Kushwaha <[email protected]>
Even after memory free of phydev, priv is still pointing to the obsolete address.
So updatepriv->phydevas NULL after memory free.Signed-off-by Prabhakar Kushwaha <[email protected]>Signed-off-by Ashish Kumar <[email protected]>Please always Cc me on network changes.
Quoted 13 lines
---
v2:
Add signoffdrivers/net/ldpaa_eth/ldpaa_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/ldpaa_eth/ldpaa_eth.c +0
-0drivers/net/ldpaa_eth/ldpaa_eth.c static void ldpaa_eth_stop(struct eth_device · line 593
Quoted 8 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +3
-1@@ -587,8 +587,10 @@ static void ldpaa_eth_stop(struct eth_device *net_dev) #ifdef CONFIG_PHYLIBif (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(). [Ashish Kumar] To keep the flow consistent of XFI(which is phy-less) to other phy based interface, inldpaa_eth_openthere are some dummy allocation, which is freed in the end instop().if ((bus == NULL) && (enet_if == PHY_INTERFACE_MODE_XGMII)) { printf("%s %s %d\n",__FILE__, __func__, __LINE__); priv->phydev = (struct phy_device *) malloc(sizeof(struct phy_device)); memset(priv->phydev, 0, sizeof(struct phy_device)); priv->phydev->speed = SPEED_10000; priv->phydev->link = 1; priv->phydev->duplex = DUPLEX_FULL; }Quoted 10 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +0
-1#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_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v2 1/1 driver: net: ldpaa: Update priv->phydev after free()
Quoted 8 lines · Er Krishna
Hi Guys,
I want to understand cpu release command of u-boot and its implementation.
When we do cpu release <Cpu no> the satndalone application (may be kernel or so) starts running on particular processor. How does it happens ? Can anyone pls let me know this logic and point me in U -boot code for this function ?
Please dispense with the top-posting and the thread hijacking.
-Joe
Quoted 10 lines
BR/Krish
Quoted 6 lines · Ashish Kumar
Hello Joe,
Please see inline.
Regards
Ashish
PATCH v2 1/1 driver: net: ldpaa: Update priv->phydev after free()
In reply to Ashish KumarHello Joe,
Could you please ack if there are no further queries.
Regards
Ashish
-----Original Message-----
From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Ashish Kumar
Sent: Tuesday, February 21, 2017 1:17 PM
To: Joe Hershberger <[email protected]>
Cc: u-boot <[email protected]>
Subject: Re: [U-Boot] [PATCH v2] driver: net: ldpaa: Update priv->phydev after free()
Hello Joe,
Please see inline.
Regards
Ashish
-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at gmail.com]
Sent: Thursday, February 16, 2017 5:22 AM
To: Ashish Kumar <[email protected]>
Cc: u-boot <[email protected]>
Subject: Re: [U-Boot] [PATCH v2] driver: net: ldpaa: Update priv->phydev after free()
Quoted 8 lines · Ashish Kumar
From: Prabhakar Kushwaha <[email protected]>
Even after memory free of phydev, priv is still pointing to the obsolete address.
So updatepriv->phydevas NULL after memory free.Signed-off-by Prabhakar Kushwaha <[email protected]>Signed-off-by Ashish Kumar <[email protected]>
Please always Cc me on network changes.
Quoted 13 lines
---
v2:
Add signoffdrivers/net/ldpaa_eth/ldpaa_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/ldpaa_eth/ldpaa_eth.c +0
-0
drivers/net/ldpaa_eth/ldpaa_eth.c static void ldpaa_eth_stop(struct eth_device · line 593
Quoted 8 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +3
-1@@ -587,8 +587,10 @@ static void ldpaa_eth_stop(struct eth_device *net_dev) #ifdef CONFIG_PHYLIBif (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().
[Ashish Kumar] To keep the flow consistent of XFI(which is phy-less) to other phy based interface, in ldpaa_eth_open there are some dummy allocation, which is freed in the end in stop().
if ((bus == NULL) &&
(enet_if == PHY_INTERFACE_MODE_XGMII)) {
printf("%s %s %d\n",__FILE__, __func__, __LINE__);
priv->phydev = (struct phy_device *)
malloc(sizeof(struct phy_device));
memset(priv->phydev, 0, sizeof(struct phy_device));
priv->phydev->speed = SPEED_10000;
priv->phydev->link = 1;
priv->phydev->duplex = DUPLEX_FULL;
}Quoted 10 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +0
-1#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
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v2 1/1 driver: net: ldpaa: Update priv->phydev after free()
In reply to Ashish KumarQuoted 42 lines · Ashish Kumar
Hello Joe,
Please see inline.
Regards
Ashish-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at gmail.com]
Sent: Thursday, February 16, 2017 5:22 AM
To: Ashish Kumar <[email protected]>
Cc: u-boot <[email protected]>
Subject: Re: [U-Boot] [PATCH v2] driver: net: ldpaa: Updatepriv->phydevafterfree()Quoted 8 lines · Ashish Kumar
From: Prabhakar Kushwaha <[email protected]>
Even after memory free of phydev, priv is still pointing to the obsolete address.
So updatepriv->phydevas NULL after memory free.Signed-off-by Prabhakar Kushwaha <[email protected]>Signed-off-by Ashish Kumar <[email protected]>Please always Cc me on network changes.
Quoted 16 lines
---
v2:
Add signoffdrivers/net/ldpaa_eth/ldpaa_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/ldpaa_eth/ldpaa_eth.c +0
-0@@ -587,8 +587,10 @@ static void ldpaa_eth_stop(struct eth_device *net_dev) #ifdef CONFIG_PHYLIBif (priv->phydev && bus !=NULL )phy_shutdown (priv->phydev);
Quoted 8 lines
drivers/net/ldpaa_eth/ldpaa_eth.c static void ldpaa_eth_stop(struct eth_device *net_dev) · line 593
Quoted 5 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +3
-1-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().
[Ashish Kumar] To keep the flow consistent of XFI(which is phy-less) to other phy based interface, inldpaa_eth_openthere are some dummy allocation, which is freed in the end instop().
It just seems strange to spread the logic out like that. Why not just check for this condition and avoid the initial allocation?
Quoted 22 lines
if ((bus == NULL) && (enet_if == PHY_INTERFACE_MODE_XGMII)) { printf("%s %s %d\n",__FILE__, __func__, __LINE__); priv->phydev = (struct phy_device *) malloc(sizeof(struct phy_device)); memset(priv->phydev, 0, sizeof(struct phy_device)); priv->phydev->speed = SPEED_10000; priv->phydev->link = 1; priv->phydev->duplex = DUPLEX_FULL; }Quoted 10 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +0
-1#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
PATCH v2 1/1 driver: net: ldpaa: Update priv->phydev after free()
Hello Joe,
Sorry for late response, please see inline.
Regards
Ashish
-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at gmail.com]
Sent: Tuesday, March 07, 2017 3:39 AM
To: Ashish Kumar <[email protected]>
Cc: u-boot <[email protected]>; Prabhakar Kushwaha <[email protected]>
Subject: Re: [U-Boot] [PATCH v2] driver: net: ldpaa: Update priv->phydev after free()
Quoted 43 lines · Ashish Kumar
Hello Joe,
Please see inline.
Regards
Ashish-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at gmail.com]
Sent: Thursday, February 16, 2017 5:22 AM
To: Ashish Kumar <[email protected]>
Cc: u-boot <[email protected]>
Subject: Re: [U-Boot] [PATCH v2] driver: net: ldpaa: Updatepriv->phydevafterfree()Quoted 8 lines · Ashish Kumar
From: Prabhakar Kushwaha <[email protected]>
Even after memory free of phydev, priv is still pointing to the obsolete address.
So updatepriv->phydevas NULL after memory free.Signed-off-by Prabhakar Kushwaha <[email protected]>Signed-off-by Ashish Kumar <[email protected]>Please always Cc me on network changes.
Quoted 16 lines
---
v2:
Add signoffdrivers/net/ldpaa_eth/ldpaa_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/ldpaa_eth/ldpaa_eth.c +0
-0@@ -587,8 +587,10 @@ static void ldpaa_eth_stop(struct eth_device *net_dev) #ifdef CONFIG_PHYLIBif (priv->phydev && bus !=NULL )phy_shutdown (priv->phydev);
Quoted 8 lines
drivers/net/ldpaa_eth/ldpaa_eth.c static void ldpaa_eth_stop(struct eth_device *net_dev) · line 593
Quoted 5 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +3
-1-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().
[Ashish Kumar] To keep the flow consistent of XFI(which is phy-less) to other phy based interface, inldpaa_eth_openthere are some dummy allocation, which is freed in the end instop().
It just seems strange to spread the logic out like that. Why not just check for this condition and avoid the initial allocation? [Ashish Kumar] In that case, I have to add flag all over the code as to first check if it is XFI, then skip the usage of structure (phydev)'s member.
Quoted 22 lines
if ((bus == NULL) && (enet_if == PHY_INTERFACE_MODE_XGMII)) { printf("%s %s %d\n",__FILE__, __func__, __LINE__); priv->phydev = (struct phy_device *) malloc(sizeof(struct phy_device)); memset(priv->phydev, 0, sizeof(struct phy_device)); priv->phydev->speed = SPEED_10000; priv->phydev->link = 1; priv->phydev->duplex = DUPLEX_FULL; }Quoted 10 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +0
-1#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
Hi Ashish,
https://patchwork.ozlabs.org/patch/728259/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git
Thanks!
-Joe