Hi Kiseok, https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Kiseok-Jo/ASoC-sma1303-Add-driver-for-Iron-Device-SMA1303-Amp/20230104-150052 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20230104064342.2094-4-kiseok.jo%40irondevice.com patch subject: [PATCH 3/3] ASOC: sma1303: change the overall contents config: ia64-randconfig-m041-20230101 compiler: ia64-linux-gcc (GCC) 12.1.0 If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@xxxxxxxxx> | Reported-by: Dan Carpenter <error27@xxxxxxxxx> smatch warnings: sound/soc/codecs/sma1303.c:257 sma1303_regmap_write() error: uninitialized symbol 'ret'. sound/soc/codecs/sma1303.c:275 sma1303_regmap_update_bits() error: uninitialized symbol 'ret'. sound/soc/codecs/sma1303.c:293 sma1303_regmap_read() error: uninitialized symbol 'ret'. sound/soc/codecs/sma1303.c:684 sma1303_add_component_controls() error: not allocating enough for = 'name' 8 vs 3 (This should allocate sizeof() not ARRAY_SIZE()). sound/soc/codecs/sma1303.c:1539 sma1303_i2c_probe() warn: unsigned 'value' is never less than zero. vim +/ret +257 sound/soc/codecs/sma1303.c 287cf116194f9c Kiseok Jo 2023-01-04 242 static int sma1303_regmap_write(struct sma1303_priv *sma1303, 0b15568ccfb962 Kiseok Jo 2023-01-04 243 unsigned int reg, unsigned int val) 0b15568ccfb962 Kiseok Jo 2023-01-04 244 { 287cf116194f9c Kiseok Jo 2023-01-04 245 int ret; 287cf116194f9c Kiseok Jo 2023-01-04 246 int cnt = sma1303->retry_cnt; 0b15568ccfb962 Kiseok Jo 2023-01-04 247 287cf116194f9c Kiseok Jo 2023-01-04 248 while (cnt--) { The way I look at it, you need three bugs for this to affect real life: BUG 1: sma1303_regmap_write() is not written robustly (this warning). BUG 2: sma1303_i2c_probe() allows sma1303->retry_cnt of zero (it does). BUG 3: The i2c-retry_count is set to zero. (Probably not but also not unimaginable). So, yeah, let's fix BUG 2 because retry_cnt of zero is bogus. if (!of_property_read_u32(np, "i2c-retry_count", &value)) { - if (value > 50 || value < 0) { + if (value > 50 || value <= 0) { sma1303->retry_cnt = SMA1303_I2C_RETRY_COUNT; And BUG 1 to make the checker happy. - int ret; + int ret = -EINVAL; 287cf116194f9c Kiseok Jo 2023-01-04 249 ret = regmap_write(sma1303->regmap, reg, val); 0b15568ccfb962 Kiseok Jo 2023-01-04 250 if (ret < 0) { 287cf116194f9c Kiseok Jo 2023-01-04 251 dev_err(sma1303->dev, "Failed to write [0x%02X]\n", reg); 287cf116194f9c Kiseok Jo 2023-01-04 252 if (gCallback.set_i2c_err) 287cf116194f9c Kiseok Jo 2023-01-04 253 gCallback.set_i2c_err(sma1303->dev, ret); 287cf116194f9c Kiseok Jo 2023-01-04 254 } else 287cf116194f9c Kiseok Jo 2023-01-04 255 break; 0b15568ccfb962 Kiseok Jo 2023-01-04 256 } 0b15568ccfb962 Kiseok Jo 2023-01-04 @257 return ret; 0b15568ccfb962 Kiseok Jo 2023-01-04 258 } 0b15568ccfb962 Kiseok Jo 2023-01-04 259 287cf116194f9c Kiseok Jo 2023-01-04 260 static int sma1303_regmap_update_bits(struct sma1303_priv *sma1303, 0b15568ccfb962 Kiseok Jo 2023-01-04 261 unsigned int reg, unsigned int mask, unsigned int val) 0b15568ccfb962 Kiseok Jo 2023-01-04 262 { 287cf116194f9c Kiseok Jo 2023-01-04 263 int ret; 287cf116194f9c Kiseok Jo 2023-01-04 264 int cnt = sma1303->retry_cnt; 0b15568ccfb962 Kiseok Jo 2023-01-04 265 287cf116194f9c Kiseok Jo 2023-01-04 266 while (cnt--) { 287cf116194f9c Kiseok Jo 2023-01-04 267 ret = regmap_update_bits(sma1303->regmap, reg, mask, val); 0b15568ccfb962 Kiseok Jo 2023-01-04 268 if (ret < 0) { 287cf116194f9c Kiseok Jo 2023-01-04 269 dev_err(sma1303->dev, "Failed to update [0x%02X]\n", reg); 287cf116194f9c Kiseok Jo 2023-01-04 270 if (gCallback.set_i2c_err) 287cf116194f9c Kiseok Jo 2023-01-04 271 gCallback.set_i2c_err(sma1303->dev, ret); 287cf116194f9c Kiseok Jo 2023-01-04 272 } else 287cf116194f9c Kiseok Jo 2023-01-04 273 break; 0b15568ccfb962 Kiseok Jo 2023-01-04 274 } 0b15568ccfb962 Kiseok Jo 2023-01-04 @275 return ret; 0b15568ccfb962 Kiseok Jo 2023-01-04 276 } 0b15568ccfb962 Kiseok Jo 2023-01-04 277 287cf116194f9c Kiseok Jo 2023-01-04 278 static int sma1303_regmap_read(struct sma1303_priv *sma1303, 287cf116194f9c Kiseok Jo 2023-01-04 279 unsigned int reg, unsigned int *val) 0b15568ccfb962 Kiseok Jo 2023-01-04 280 { 287cf116194f9c Kiseok Jo 2023-01-04 281 int ret; 287cf116194f9c Kiseok Jo 2023-01-04 282 int cnt = sma1303->retry_cnt; 0b15568ccfb962 Kiseok Jo 2023-01-04 283 287cf116194f9c Kiseok Jo 2023-01-04 284 while (cnt--) { 287cf116194f9c Kiseok Jo 2023-01-04 285 ret = regmap_read(sma1303->regmap, reg, val); 0b15568ccfb962 Kiseok Jo 2023-01-04 286 if (ret < 0) { 287cf116194f9c Kiseok Jo 2023-01-04 287 dev_err(sma1303->dev, "Failed to read [0x%02X]\n", reg); 287cf116194f9c Kiseok Jo 2023-01-04 288 if (gCallback.set_i2c_err) 287cf116194f9c Kiseok Jo 2023-01-04 289 gCallback.set_i2c_err(sma1303->dev, ret); 287cf116194f9c Kiseok Jo 2023-01-04 290 } else 287cf116194f9c Kiseok Jo 2023-01-04 291 break; 0b15568ccfb962 Kiseok Jo 2023-01-04 292 } 287cf116194f9c Kiseok Jo 2023-01-04 @293 return ret; 0b15568ccfb962 Kiseok Jo 2023-01-04 294 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests