Skip to content

Commit cdcb380

Browse files
RandDeebanguy11
authored andcommitted
ixgbe: Fix unreachable retry logic in combined and byte I2C write functions
The current implementation of `ixgbe_write_i2c_combined_generic_int` and `ixgbe_write_i2c_byte_generic_int` sets `max_retry` to `1`, which makes the condition `retry < max_retry` always evaluate to `false`. This renders the retry mechanism ineffective, as the debug message and retry logic are never executed. This patch increases `max_retry` to `3` in both functions, aligning them with the retry logic in `ixgbe_read_i2c_combined_generic_int`. This ensures that the retry mechanism functions as intended, improving robustness in case of I2C write failures. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Rand Deeb <[email protected]> Tested-by: Rinitha S <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent 015bac5 commit cdcb380

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ int ixgbe_write_i2c_combined_generic_int(struct ixgbe_hw *hw, u8 addr,
167167
u16 reg, u16 val, bool lock)
168168
{
169169
u32 swfw_mask = hw->phy.phy_semaphore_mask;
170-
int max_retry = 1;
170+
int max_retry = 3;
171171
int retry = 0;
172172
u8 reg_high;
173173
u8 csum;
@@ -2285,7 +2285,7 @@ static int ixgbe_write_i2c_byte_generic_int(struct ixgbe_hw *hw, u8 byte_offset,
22852285
u8 dev_addr, u8 data, bool lock)
22862286
{
22872287
u32 swfw_mask = hw->phy.phy_semaphore_mask;
2288-
u32 max_retry = 1;
2288+
u32 max_retry = 3;
22892289
u32 retry = 0;
22902290
int status;
22912291

0 commit comments

Comments
 (0)