mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Murali Karicheri <m-karicheri2@ti.com>
To: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	<w-kwok2@ti.com>, <davem@davemloft.net>
Subject: [PATCH 2/3] net: netcp: ethss: fix up incorrect use of list api
Date: Tue, 28 Jul 2015 18:20:13 -0400	[thread overview]
Message-ID: <1438122014-24744-3-git-send-email-m-karicheri2@ti.com> (raw)
In-Reply-To: <1438122014-24744-1-git-send-email-m-karicheri2@ti.com>

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>
---
 drivers/net/ethernet/ti/netcp_ethss.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
index 9b7e0a3..77bcfca 100644
--- a/drivers/net/ethernet/ti/netcp_ethss.c
+++ b/drivers/net/ethernet/ti/netcp_ethss.c
@@ -2490,10 +2490,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);
-- 
1.9.1


  parent reply	other threads:[~2015-07-28 22:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 22:20 [PATCH 0/3] net: netcp: bug fixes for dynamic module support Murali Karicheri
2015-07-28 22:20 ` [PATCH 1/3] net: netcp: fix cleanup interface list in netcp_remove() Murali Karicheri
2015-07-28 22:20 ` Murali Karicheri [this message]
2015-07-28 22:20 ` [PATCH 3/3] net: netcp: ethss: cleanup gbe_probe() and gbe_remove() functions Murali Karicheri
2015-07-30  1:38 ` [PATCH 0/3] net: netcp: bug fixes for dynamic module support David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438122014-24744-3-git-send-email-m-karicheri2@ti.com \
    --to=m-karicheri2@ti.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=w-kwok2@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®