[Intel-wired-lan] [PATCH iwl-next v1] ixgbe: Convert ret val type from s32 to int

Przemek Kitszel przemyslaw.kitszel at intel.com
Fri Jan 5 07:14:22 UTC 2024


On 1/4/24 15:47, Dan Carpenter wrote:
> Hi Jedrzej,
> 
> kernel test robot noticed the following build warnings:
> 
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Jedrzej-Jagielski/ixgbe-Convert-ret-val-type-from-s32-to-int/20240103-182213
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git master
> patch link:    https://lore.kernel.org/r/20240103101135.386891-1-jedrzej.jagielski%40intel.com
> patch subject: [PATCH iwl-next v1] ixgbe: Convert ret val type from s32 to int
> config: i386-randconfig-141-20240104 (https://download.01.org/0day-ci/archive/20240104/202401041701.6QKTsZmx-lkp@intel.com/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp at intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter at linaro.org>
> | Closes: https://lore.kernel.org/r/202401041701.6QKTsZmx-lkp@intel.com/
> 
> New smatch warnings:
> drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c:2884 ixgbe_get_lcd_t_x550em() warn: missing error code? 'status'
> drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c:3130 ixgbe_enter_lplu_t_x550em() warn: missing error code? 'status'
> 
> Old smatch warnings:
> drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c:2890 ixgbe_get_lcd_t_x550em() warn: missing error code? 'status'
> 
> vim +/status +2884 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
> 
> 9ea222bfe41f87 Jedrzej Jagielski 2024-01-03  2866  static int ixgbe_get_lcd_t_x550em(struct ixgbe_hw *hw,
> 6ac7439459606a Don Skidmore      2015-06-17  2867  				  ixgbe_link_speed *lcd_speed)
> 6ac7439459606a Don Skidmore      2015-06-17  2868  {
> 6ac7439459606a Don Skidmore      2015-06-17  2869  	u16 an_lp_status;
> 9ea222bfe41f87 Jedrzej Jagielski 2024-01-03  2870  	int status;
> 6ac7439459606a Don Skidmore      2015-06-17  2871  	u16 word = hw->eeprom.ctrl_word_3;
> 6ac7439459606a Don Skidmore      2015-06-17  2872
> 6ac7439459606a Don Skidmore      2015-06-17  2873  	*lcd_speed = IXGBE_LINK_SPEED_UNKNOWN;
> 6ac7439459606a Don Skidmore      2015-06-17  2874
> 6ac7439459606a Don Skidmore      2015-06-17  2875  	status = hw->phy.ops.read_reg(hw, IXGBE_AUTO_NEG_LP_STATUS,
> 4dc4000b35119f Emil Tantilov     2016-09-26  2876  				      MDIO_MMD_AN,
> 6ac7439459606a Don Skidmore      2015-06-17  2877  				      &an_lp_status);
> 6ac7439459606a Don Skidmore      2015-06-17  2878  	if (status)
> 6ac7439459606a Don Skidmore      2015-06-17  2879  		return status;
> 6ac7439459606a Don Skidmore      2015-06-17  2880
> 6ac7439459606a Don Skidmore      2015-06-17  2881  	/* If link partner advertised 1G, return 1G */
> 6ac7439459606a Don Skidmore      2015-06-17  2882  	if (an_lp_status & IXGBE_AUTO_NEG_LP_1000BASE_CAP) {
> 6ac7439459606a Don Skidmore      2015-06-17  2883  		*lcd_speed = IXGBE_LINK_SPEED_1GB_FULL;
> 6ac7439459606a Don Skidmore      2015-06-17 @2884  		return status;

indeed, 'return 0' would be clearer here

> 
> Smatch only warns about missing error codes when the function returns an
> int.  :P  The bug predates your patch obvoiusly.

:D

> 
> 6ac7439459606a Don Skidmore      2015-06-17  2885  	}
> 6ac7439459606a Don Skidmore      2015-06-17  2886
> 6ac7439459606a Don Skidmore      2015-06-17  2887  	/* If 10G disabled for LPLU via NVM D10GMP, then return no valid LCD */
> 6ac7439459606a Don Skidmore      2015-06-17  2888  	if ((hw->bus.lan_id && (word & NVM_INIT_CTRL_3_D10GMP_PORT1)) ||
> 6ac7439459606a Don Skidmore      2015-06-17  2889  	    (word & NVM_INIT_CTRL_3_D10GMP_PORT0))
> 6ac7439459606a Don Skidmore      2015-06-17  2890  		return status;
> 6ac7439459606a Don Skidmore      2015-06-17  2891
> 6ac7439459606a Don Skidmore      2015-06-17  2892  	/* Link partner not capable of lower speeds, return 10G */
> 6ac7439459606a Don Skidmore      2015-06-17  2893  	*lcd_speed = IXGBE_LINK_SPEED_10GB_FULL;
> 6ac7439459606a Don Skidmore      2015-06-17  2894  	return status;
> 6ac7439459606a Don Skidmore      2015-06-17  2895  }
> 



More information about the Intel-wired-lan mailing list