Skip to content

Commit

Permalink
net: netcp: ethss: fix up incorrect use of list api
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Karicheri, Muralidharan authored and David S. Miller committed Jul 30, 2015
1 parent 01a0309 commit c20afae
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/net/ethernet/ti/netcp_ethss.c
Original file line number Diff line number Diff line change
Expand Up @@ -2508,10 +2508,9 @@ static void free_secondary_ports(struct gbe_priv *gbe_dev)
{
struct gbe_slave *slave;

for (;;) {
while (!list_empty(&gbe_dev->secondary_slaves)) {
slave = first_sec_slave(gbe_dev);
if (!slave)
break;

if (slave->phy)
phy_disconnect(slave->phy);
list_del(&slave->slave_list);
Expand Down

0 comments on commit c20afae

Please sign in to comment.