From: Karicheri, Muralidharan Date: Tue, 28 Jul 2015 22:20:13 +0000 (-0400) Subject: net: netcp: ethss: fix up incorrect use of list api X-Git-Tag: Ubuntu-5.0.0-8.9~8947^2~10^2~1 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=c20afae75c32ec69eccc4ee432fa27d426e85a83;p=mirror_ubuntu-disco-kernel.git 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index a21881219865..d11d6172941a 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -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);