[dpdk-dev] [PATCH v2 13/42] net/e1000/base: modify klockwork about unused return values

Guinan Sun guinanx.sun at intel.com
Wed Jun 24 09:53:08 CEST 2020


Klockwork found unreachable code since *clock_in_i2c_* always return
success. Don't return unused s32 and don't check for constants.

Signed-off-by: Todd Fujinaka <todd.fujinaka at intel.com>
Signed-off-by: Guinan Sun <guinanx.sun at intel.com>
---
 drivers/net/e1000/base/e1000_82575.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/net/e1000/base/e1000_82575.c b/drivers/net/e1000/base/e1000_82575.c
index 021a54fc5..c49e81ae5 100644
--- a/drivers/net/e1000/base/e1000_82575.c
+++ b/drivers/net/e1000/base/e1000_82575.c
@@ -75,10 +75,10 @@ STATIC void e1000_clear_vfta_i350(struct e1000_hw *hw);
 
 STATIC void e1000_i2c_start(struct e1000_hw *hw);
 STATIC void e1000_i2c_stop(struct e1000_hw *hw);
-STATIC s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data);
+STATIC void e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data);
 STATIC s32 e1000_clock_out_i2c_byte(struct e1000_hw *hw, u8 data);
 STATIC s32 e1000_get_i2c_ack(struct e1000_hw *hw);
-STATIC s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data);
+STATIC void e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data);
 STATIC s32 e1000_clock_out_i2c_bit(struct e1000_hw *hw, bool data);
 STATIC void e1000_raise_i2c_clk(struct e1000_hw *hw, u32 *i2cctl);
 STATIC void e1000_lower_i2c_clk(struct e1000_hw *hw, u32 *i2cctl);
@@ -3300,9 +3300,7 @@ s32 e1000_read_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset,
 		if (status != E1000_SUCCESS)
 			goto fail;
 
-		status = e1000_clock_in_i2c_byte(hw, data);
-		if (status != E1000_SUCCESS)
-			goto fail;
+		e1000_clock_in_i2c_byte(hw, data);
 
 		status = e1000_clock_out_i2c_bit(hw, nack);
 		if (status != E1000_SUCCESS)
@@ -3466,7 +3464,7 @@ STATIC void e1000_i2c_stop(struct e1000_hw *hw)
  *
  *  Clocks in one byte data via I2C data/clock
  **/
-STATIC s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data)
+STATIC void e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data)
 {
 	s32 i;
 	bool bit = 0;
@@ -3478,8 +3476,6 @@ STATIC s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data)
 		e1000_clock_in_i2c_bit(hw, &bit);
 		*data |= bit << i;
 	}
-
-	return E1000_SUCCESS;
 }
 
 /**
@@ -3568,7 +3564,7 @@ STATIC s32 e1000_get_i2c_ack(struct e1000_hw *hw)
  *
  *  Clocks in one bit via I2C data/clock
  **/
-STATIC s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data)
+STATIC void e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data)
 {
 	u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS);
 
@@ -3586,8 +3582,6 @@ STATIC s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data)
 
 	/* Minimum low period of clock is 4.7 us */
 	usec_delay(E1000_I2C_T_LOW);
-
-	return E1000_SUCCESS;
 }
 
 /**
-- 
2.17.1



More information about the dev mailing list