From: kernel test robot <lkp@intel.com>
To: Wensheng Wang <wenswang@yeah.net>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
linux-hwmon@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>
Subject: [groeck-staging:hwmon-next 79/87] drivers/hwmon/pmbus/mp2925.c:159:11: warning: variable 'ret' is uninitialized when used here
Date: Thu, 25 Sep 2025 14:03:47 +0800 [thread overview]
Message-ID: <202509251422.Cnmuh8EH-lkp@intel.com> (raw)
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
reply other threads:[~2025-09-25 6:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202509251422.Cnmuh8EH-lkp@intel.com \
--to=lkp@intel.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=wenswang@yeah.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox