aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Mason <jon.mason@intel.com>2013-11-22 18:44:13 -0500
committerJon Mason <jon.mason@intel.com>2014-04-07 13:58:14 -0400
commitfea903ecd799ec49a2ebc4cc8cfb7bb96fd31ddc (patch)
treebfe894438f7c9a22b0ce1735106748d590cfdf0e
parent455c6fdbd219161bd09b1165f11699d6d73de11c (diff)
ntb_netdev: Fix list_for_each_entry exit issue
If list_for_each_entry exits without finding the ntb_device, the dev pointer will not be NULL. Thus the check will never be true and the code will not exit when it should. Correct this by adding a bool to determine when the device is found, otherwise exit in good fashion. Signed-off-by: Jon Mason <jon.mason@intel.com>
-rw-r--r--drivers/net/ntb_netdev.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
index f3cdf64997d6..8298880bfdd8 100644
--- a/drivers/net/ntb_netdev.c
+++ b/drivers/net/ntb_netdev.c
@@ -367,12 +367,15 @@ static void ntb_netdev_remove(struct pci_dev *pdev)
367{ 367{
368 struct net_device *ndev; 368 struct net_device *ndev;
369 struct ntb_netdev *dev; 369 struct ntb_netdev *dev;
370 bool found = false;
370 371
371 list_for_each_entry(dev, &dev_list, list) { 372 list_for_each_entry(dev, &dev_list, list) {
372 if (dev->pdev == pdev) 373 if (dev->pdev == pdev) {
374 found = true;
373 break; 375 break;
376 }
374 } 377 }
375 if (dev == NULL) 378 if (!found)
376 return; 379 return;
377 380
378 list_del(&dev->list); 381 list_del(&dev->list);