Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: rt1320: Change return type of rt1320_t0_load() to void

Clang warns (or errors with CONFIG_WERROR=y / W=e):

sound/soc/codecs/rt1320-sdw.c:1387:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
1387 | if (!fw_ready) {
| ^~~~~~~~~
sound/soc/codecs/rt1320-sdw.c:1421:9: note: uninitialized use occurs here
1421 | return ret;
| ^~~
sound/soc/codecs/rt1320-sdw.c:1387:2: note: remove the 'if' if its condition is always false
1387 | if (!fw_ready) {
| ^~~~~~~~~~~~~~~~
1388 | dev_warn(dev, "%s, DSP FW is NOT ready\n", __func__);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1389 | goto _exit_;
| ~~~~~~~~~~~~
1390 | }
| ~
sound/soc/codecs/rt1320-sdw.c:1366:9: note: initialize the variable 'ret' to silence this warning
1366 | int ret;
| ^
| = 0

The return value of rt1320_t0_load() is never actually used, so it can
just be eliminated altogether by returning void, clearing up the
warning.

Fixes: da1682d5e8b5 ("ASoC: rt1320: support calibration and temperature/r0 loading")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512191711.wY6XU796-lkp@intel.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Shuming Fan <shumingf@realtek.com>
Link: https://patch.msgid.link/20251219-rt1320-sdw-avoid-uninit-ret-v1-1-faa3e250ebc4@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Nathan Chancellor and committed by
Mark Brown
9e692bb5 dc8d1ba5

+3 -7
+3 -7
sound/soc/codecs/rt1320-sdw.c
··· 1359 1359 } 1360 1360 } 1361 1361 1362 - static int rt1320_t0_load(struct rt1320_sdw_priv *rt1320, unsigned int l_t0, unsigned int r_t0) 1362 + static void rt1320_t0_load(struct rt1320_sdw_priv *rt1320, unsigned int l_t0, unsigned int r_t0) 1363 1363 { 1364 1364 struct device *dev = &rt1320->sdw_slave->dev; 1365 1365 unsigned int factor = (1 << 22), fw_ready; 1366 1366 int l_t0_data[38], r_t0_data[38]; 1367 1367 unsigned int fw_status_addr; 1368 - int ret; 1369 1368 1370 1369 switch (rt1320->dev_id) { 1371 1370 case RT1320_DEV_ID: ··· 1375 1376 break; 1376 1377 default: 1377 1378 dev_err(dev, "%s: Unknown device ID %d\n", __func__, rt1320->dev_id); 1378 - return -EINVAL; 1379 + return; 1379 1380 } 1380 1381 1381 1382 regmap_write(rt1320->regmap, ··· 1400 1401 1401 1402 rt1320_fw_param_protocol(rt1320, RT1320_SET_PARAM, 3, &l_t0_data[0], sizeof(l_t0_data)); 1402 1403 rt1320_fw_param_protocol(rt1320, RT1320_SET_PARAM, 4, &r_t0_data[0], sizeof(r_t0_data)); 1403 - ret = rt1320_check_fw_ready(rt1320); 1404 - if (ret < 0) 1404 + if (rt1320_check_fw_ready(rt1320) < 0) 1405 1405 dev_err(dev, "%s: Failed to set FW param 3,4!\n", __func__); 1406 1406 1407 1407 rt1320->temp_l_calib = l_t0; ··· 1417 1419 SDW_SDCA_CTL(FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23, 1418 1420 RT1320_SDCA_CTL_REQ_POWER_STATE, 0), 0x03); 1419 1421 rt1320_pde_transition_delay(rt1320, FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23, 0x03); 1420 - 1421 - return ret; 1422 1422 } 1423 1423 1424 1424 static int rt1320_rae_load(struct rt1320_sdw_priv *rt1320)