igb: fix itnull.cocci warnings
diff mbox

Message ID alpine.DEB.2.10.1512231351120.4367@hadrien
State Superseded
Headers show

Commit Message

Julia Lawall Dec. 23, 2015, 12:52 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>
---

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

Comments

Brown, Aaron F Jan. 7, 2016, 2:09 a.m. UTC | #1
> From: Intel-wired-lan [intel-wired-lan-bounces@lists.osuosl.org] on behalf of Julia Lawall [julia.lawall@lip6.fr]
> Sent: Wednesday, December 23, 2015 4:52 AM
> To: Gangfeng Huang
> Cc: intel-wired-lan@lists.osuosl.org; kbuild-all@01.org
> Subject: [Intel-wired-lan] [PATCH] igb: fix itnull.cocci warnings
> 
> 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>
> ---
> 
>  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);