Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [groeck-staging:hwmon-next 79/87] drivers/hwmon/pmbus/mp2925.c:159:11: warning: variable 'ret' is uninitialized when used here
@ 2025-09-25  6:03 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-09-25  6:03 UTC (permalink / raw)
  To: Wensheng Wang; +Cc: llvm, oe-kbuild-all, linux-hwmon, Guenter Roeck

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
head:   5f6722c971aa9d5b9736701926c3fdd1928db272
commit: b3a4efc88601cb5fc97b4ae23c478700a60302da [79/87] hwmon: add MP2925 and MP2929 driver
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250925/202509251422.Cnmuh8EH-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250925/202509251422.Cnmuh8EH-lkp@intel.com/reproduce)

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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509251422.Cnmuh8EH-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/hwmon/pmbus/mp2925.c:159:11: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
     159 |                                             (ret & ~GENMASK(11, 0)) |
         |                                              ^~~
   drivers/hwmon/pmbus/mp2925.c:137:9: note: initialize the variable 'ret' to silence this warning
     137 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.


vim +/ret +159 drivers/hwmon/pmbus/mp2925.c

   133	
   134	static int mp2925_write_word_data(struct i2c_client *client, int page, int reg,
   135					  u16 word)
   136	{
   137		int ret;
   138	
   139		switch (reg) {
   140		case PMBUS_VIN_OV_FAULT_LIMIT:
   141		case PMBUS_VIN_OV_WARN_LIMIT:
   142		case PMBUS_VIN_UV_WARN_LIMIT:
   143		case PMBUS_VIN_UV_FAULT_LIMIT:
   144			/*
   145			 * The PMBUS_VIN_OV_FAULT_LIMIT, PMBUS_VIN_OV_WARN_LIMIT,
   146			 * PMBUS_VIN_UV_WARN_LIMIT and PMBUS_VIN_UV_FAULT_LIMIT
   147			 * of MP2925 is linear11 format, and the exponent is a
   148			 * constant value(5'b11100), so the exponent of word
   149			 * parameter should be converted to 5'b11100(0x1C).
   150			 */
   151			ret = pmbus_write_word_data(client, page, reg,
   152						    mp2925_linear_exp_transfer(word, 0x1C));
   153			if (ret < 0)
   154				return ret;
   155			break;
   156		case PMBUS_VOUT_OV_FAULT_LIMIT:
   157		case PMBUS_VOUT_UV_FAULT_LIMIT:
   158			ret = pmbus_write_word_data(client, page, reg,
 > 159						    (ret & ~GENMASK(11, 0)) |
   160					FIELD_PREP(GENMASK(11, 0),
   161						   DIV_ROUND_CLOSEST(word * MP2925_VOUT_OVUV_DIV,
   162								     MP2925_VOUT_OVUV_UINT)));
   163			break;
   164		case PMBUS_OT_FAULT_LIMIT:
   165		case PMBUS_OT_WARN_LIMIT:
   166			/*
   167			 * The PMBUS_OT_FAULT_LIMIT and PMBUS_OT_WARN_LIMIT of
   168			 * MP2925 is linear11 format, and the exponent is a
   169			 * constant value(5'b00000), so the exponent of word
   170			 * parameter should be converted to 5'b00000.
   171			 */
   172			ret = pmbus_write_word_data(client, page, reg,
   173						    mp2925_linear_exp_transfer(word, 0x00));
   174			if (ret < 0)
   175				return ret;
   176			break;
   177		case PMBUS_IOUT_OC_FAULT_LIMIT:
   178		case PMBUS_IOUT_OC_WARN_LIMIT:
   179			/*
   180			 * The PMBUS_IOUT_OC_FAULT_LIMIT and PMBUS_IOUT_OC_WARN_LIMIT
   181			 * of MP2925 is linear11 format, and the exponent is a
   182			 * can not be changed.
   183			 */
   184			ret = pmbus_read_word_data(client, page, 0xff, reg);
   185			if (ret < 0)
   186				return ret;
   187	
   188			ret = pmbus_write_word_data(client, page, reg,
   189						    mp2925_linear_exp_transfer(word,
   190									       FIELD_GET(GENMASK(15, 11),
   191											 ret)));
   192			break;
   193		default:
   194			ret = -EINVAL;
   195			break;
   196		}
   197	
   198		return ret;
   199	}
   200	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-25  6:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25  6:03 [groeck-staging:hwmon-next 79/87] drivers/hwmon/pmbus/mp2925.c:159:11: warning: variable 'ret' is uninitialized when used here kernel test robot

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