[v2] igb: fix itnull.cocci warnings
diff mbox

Message ID alpine.DEB.2.10.1512231354150.4367@hadrien
State Not Applicable
Delegated to: Jeff Kirsher
Headers show

Commit Message

Julia Lawall Dec. 23, 2015, 12:55 p.m. UTC
The index variable of list_for_each_entry_safe should never be NULL.

Generated by: scripts/coccinelle/iterators/itnull.cocci

CC: Gangfeng Huang <gangfeng.huang@ni.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
---

v2: Add sign off

 igb_cdev.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jeff Kirsher Jan. 8, 2016, 6:25 a.m. UTC | #1
On Wed, 2015-12-23 at 13:55 +0100, Julia Lawall wrote:
> The index variable of list_for_each_entry_safe should never be NULL.
> 
> Generated by: scripts/coccinelle/iterators/itnull.cocci
> 
> CC: Gangfeng Huang <gangfeng.huang@ni.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
> ---
> 
> v2: Add sign off
> 
>  igb_cdev.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Tested-by: Aaron Brown <aaron.f.brown@intel.com>

Patch
diff mbox

--- a/drivers/net/ethernet/intel/igb/igb_cdev.c
+++ b/drivers/net/ethernet/intel/igb/igb_cdev.c
@@ -411,8 +411,7 @@  static int igb_close_file(struct inode *

 		list_for_each_entry_safe(userpage, tmp,
 					 &adapter->user_page_list, page_node) {
-			if (userpage)
-				igb_free_page(adapter, userpage);
+			igb_free_page(adapter, userpage);
 		}
 	}
 	mutex_unlock(&adapter->user_page_mutex);