Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [Question] Dead code in ixgbe_init_eeprom_params_generic()?
@ 2026-01-31 16:21 Ingyu Jang
  2026-02-03 10:54 ` Przemek Kitszel
  0 siblings, 1 reply; 2+ messages in thread
From: Ingyu Jang @ 2026-01-31 16:21 UTC (permalink / raw)
  To: intel-wired-lan
  Cc: anthony.l.nguyen, przemyslaw.kitszel, andrew+netdev, Ingyu Jang

Hi,

I noticed that in drivers/net/ethernet/intel/ixgbe/ixgbe_common.c,
the function ixgbe_init_eeprom_params_generic() always returns 0.

The function (at line 860) performs EEPROM initialization and
always ends with:
  return 0;

However, in drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c, there
are multiple places where the return value is checked through the
function pointer hw->eeprom.ops.init_params(hw):

1. ixgbe_read_ee_e610() at line 3627:
   err = hw->eeprom.ops.init_params(hw);
   if (err)
       return err;

2. ixgbe_write_ee_e610() at line 3660:
   err = hw->eeprom.ops.init_params(hw);
   if (err)
       return err;

3. ixgbe_validate_ee_e610() at line 3693:
   err = hw->eeprom.ops.init_params(hw);
   if (err)
       return err;

The init_params function pointer points to
ixgbe_init_eeprom_params_generic for 82598 and 82599 chips
(ixgbe_82598.c:1164, ixgbe_82599.c:2225).

Since ixgbe_init_eeprom_params_generic() never fails, these error
checks appear to be dead code for those chip types.

Is this intentional defensive coding for potential future changes,
or could this be cleaned up?

Thanks,
Ingyu Jang

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Intel-wired-lan] [Question] Dead code in ixgbe_init_eeprom_params_generic()?
  2026-01-31 16:21 [Intel-wired-lan] [Question] Dead code in ixgbe_init_eeprom_params_generic()? Ingyu Jang
@ 2026-02-03 10:54 ` Przemek Kitszel
  0 siblings, 0 replies; 2+ messages in thread
From: Przemek Kitszel @ 2026-02-03 10:54 UTC (permalink / raw)
  To: Ingyu Jang; +Cc: anthony.l.nguyen, intel-wired-lan, andrew+netdev

On 1/31/26 17:21, Ingyu Jang wrote:
> Hi,
> 
> I noticed that in drivers/net/ethernet/intel/ixgbe/ixgbe_common.c,
> the function ixgbe_init_eeprom_params_generic() always returns 0.
> 
> The function (at line 860) performs EEPROM initialization and
> always ends with:
>    return 0;
> 
> However, in drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c, there
> are multiple places where the return value is checked through the
> function pointer hw->eeprom.ops.init_params(hw):
> 
> 1. ixgbe_read_ee_e610() at line 3627:
>     err = hw->eeprom.ops.init_params(hw);
>     if (err)
>         return err;
> 
> 2. ixgbe_write_ee_e610() at line 3660:
>     err = hw->eeprom.ops.init_params(hw);
>     if (err)
>         return err;
> 
> 3. ixgbe_validate_ee_e610() at line 3693:
>     err = hw->eeprom.ops.init_params(hw);
>     if (err)
>         return err;
> 
> The init_params function pointer points to
> ixgbe_init_eeprom_params_generic for 82598 and 82599 chips
> (ixgbe_82598.c:1164, ixgbe_82599.c:2225).
> 
> Since ixgbe_init_eeprom_params_generic() never fails, these error
> checks appear to be dead code for those chip types.
> 
> Is this intentional defensive coding for potential future changes,
> or could this be cleaned up?
> 
> Thanks,
> Ingyu Jang

thank you

this originates from our OOT implementation which is over 20 years old
by now

feel free to send patch that cleans this up (and similar stuff if you
find more)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-03 10:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-31 16:21 [Intel-wired-lan] [Question] Dead code in ixgbe_init_eeprom_params_generic()? Ingyu Jang
2026-02-03 10:54 ` Przemek Kitszel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox