[Open-FCoE] [PATCH] libfcoe: Fix erroneous lookup handling

Bhanu Gollapudi bprakash at broadcom.com
Tue Jan 18 02:36:40 UTC 2011


Yi, Please include it in your v4 patch set.

Thanks,
Bhanu

From: Nithin Sujir <nithin at broadcom.com>

Return NULL if the match fails.
    
Signed-off-by: Nithin Nayak Sujir <nsujir at broadcom.com>
Signed-off-by: Bhanu Prakash Gollapudi <bprakash at broadcom.com>

diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index 95fe16b..ba09301 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -87,10 +87,10 @@ static struct fcoe_transport *fcoe_transport_lookup(const char *drv_name)
 
 	list_for_each_entry(ft, &fcoe_transports, list) {
 		if (strcmp(drv_name, ft->name) == 0)
-			break;
+			return ft;
 	}
 
-	return ft;
+	return NULL;
 }
 
 /**
@@ -210,11 +210,10 @@ static void fcoe_del_netdev_mapping(struct net_device *netdev)
 	list_for_each_entry_safe(nm, tmp, &fcoe_netdevs, list) {
 		if (nm->netdev == netdev) {
 			list_del(&nm->list);
-			break;
+			kfree(nm);
+			return;
 		}
 	}
-
-	kfree(nm);
 }
 
 
@@ -235,11 +234,11 @@ static struct fcoe_transport *fcoe_netdev_map_lookup(struct net_device *netdev)
 	list_for_each_entry(nm, &fcoe_netdevs, list) {
 		if (netdev == nm->netdev) {
 			ft = nm->ft;
-			break;
+			return ft;
 		}
 	}
 
-	return ft;
+	return NULL;
 }
 
 /**






More information about the devel mailing list