Skip to content

Commit

Permalink
igb: fix array size calculation
Browse files Browse the repository at this point in the history
Use ARRAY_SIZE for array size calculation.

Signed-off-by: Todd Fujinaka <todd.fujinaka@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  • Loading branch information
Todd Fujinaka authored and Jeff Kirsher committed Mar 8, 2014
1 parent bd9d559 commit 72b3672
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/ethernet/intel/igb/e1000_82575.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ static s32 igb_update_nvm_checksum_i350(struct e1000_hw *hw);
static const u16 e1000_82580_rxpbs_table[] =
{ 36, 72, 144, 1, 2, 4, 8, 16,
35, 70, 140 };
#define E1000_82580_RXPBS_TABLE_SIZE \
(sizeof(e1000_82580_rxpbs_table)/sizeof(u16))

/**
* igb_sgmii_uses_mdio_82575 - Determine if I2C pins are for external MDIO
Expand Down Expand Up @@ -2307,7 +2305,7 @@ u16 igb_rxpbs_adjust_82580(u32 data)
{
u16 ret_val = 0;

if (data < E1000_82580_RXPBS_TABLE_SIZE)
if (data < ARRAY_SIZE(e1000_82580_rxpbs_table))
ret_val = e1000_82580_rxpbs_table[data];

return ret_val;
Expand Down

0 comments on commit 72b3672

Please sign in to comment.