net: netcp: ethss: fix up incorrect use of list api
The code seems to assume a null is returned when the list is empty from first_sec_slave() to break the loop which is incorrect. Fix the code by using list_empty(). Signed-off-by: Murali Karicheri <m-karicheri2@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
01a030996e
commit
c20afae75c
1 changed files with 2 additions and 3 deletions
|
@ -2508,10 +2508,9 @@ static void free_secondary_ports(struct gbe_priv *gbe_dev)
|
||||||
{
|
{
|
||||||
struct gbe_slave *slave;
|
struct gbe_slave *slave;
|
||||||
|
|
||||||
for (;;) {
|
while (!list_empty(&gbe_dev->secondary_slaves)) {
|
||||||
slave = first_sec_slave(gbe_dev);
|
slave = first_sec_slave(gbe_dev);
|
||||||
if (!slave)
|
|
||||||
break;
|
|
||||||
if (slave->phy)
|
if (slave->phy)
|
||||||
phy_disconnect(slave->phy);
|
phy_disconnect(slave->phy);
|
||||||
list_del(&slave->slave_list);
|
list_del(&slave->slave_list);
|
||||||
|
|
Loading…
Add table
Reference in a new issue