Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15135627 authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Jeff Kirsher
Browse files

igb: Replace GFP_ATOMIC with GFP_KERNEL in igb_sw_init()



igb_sw_init() is never called in atomic context.
It calls kzalloc() and kcalloc() with GFP_ATOMIC, which is not necessary.
GFP_ATOMIC can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent a798fbac
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -3873,7 +3873,7 @@ static int igb_sw_init(struct igb_adapter *adapter)


	adapter->mac_table = kcalloc(hw->mac.rar_entry_count,
	adapter->mac_table = kcalloc(hw->mac.rar_entry_count,
				     sizeof(struct igb_mac_addr),
				     sizeof(struct igb_mac_addr),
				     GFP_ATOMIC);
				     GFP_KERNEL);
	if (!adapter->mac_table)
	if (!adapter->mac_table)
		return -ENOMEM;
		return -ENOMEM;


@@ -3883,7 +3883,7 @@ static int igb_sw_init(struct igb_adapter *adapter)


	/* Setup and initialize a copy of the hw vlan table array */
	/* Setup and initialize a copy of the hw vlan table array */
	adapter->shadow_vfta = kcalloc(E1000_VLAN_FILTER_TBL_SIZE, sizeof(u32),
	adapter->shadow_vfta = kcalloc(E1000_VLAN_FILTER_TBL_SIZE, sizeof(u32),
				       GFP_ATOMIC);
				       GFP_KERNEL);
	if (!adapter->shadow_vfta)
	if (!adapter->shadow_vfta)
		return -ENOMEM;
		return -ENOMEM;