tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: ae5179317e794160e471db0e122c6ac811a97235 commit: 0700bc2fb94c28459f57a10d2ee2c7ef4cb70862 [2951/11937] ASoC: wm_adsp: Separate generic cs_dsp_coeff_ctl handling config: riscv-randconfig-m031-20211027 (attached as .config) compiler: riscv32-linux-gcc (GCC) 11.2.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> New smatch warnings: sound/soc/codecs/wm_adsp.c:1441 wm_adsp_control_add() error: uninitialized symbol 'ret'. vim +/ret +1441 sound/soc/codecs/wm_adsp.c 0700bc2fb94c28 Simon Trimmer 2021-09-13 1405 static int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl) b21acc1c370f72 Charles Keepax 2015-04-13 1406 { 0700bc2fb94c28 Simon Trimmer 2021-09-13 1407 struct wm_adsp *dsp = cs_ctl->dsp; b21acc1c370f72 Charles Keepax 2015-04-13 1408 struct wm_coeff_ctl *ctl; b21acc1c370f72 Charles Keepax 2015-04-13 1409 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 9ce5e6e61122cd Richard Fitzgerald 2016-11-09 1410 const char *region_name; b21acc1c370f72 Charles Keepax 2015-04-13 1411 int ret; b21acc1c370f72 Charles Keepax 2015-04-13 1412 0700bc2fb94c28 Simon Trimmer 2021-09-13 1413 if (cs_ctl->flags & WMFW_CTL_FLAG_SYS) 6477960755fb2c Charles Keepax 2021-09-13 1414 return 0; 6477960755fb2c Charles Keepax 2021-09-13 1415 0700bc2fb94c28 Simon Trimmer 2021-09-13 1416 region_name = cs_dsp_mem_region_name(cs_ctl->alg_region.type); 9ce5e6e61122cd Richard Fitzgerald 2016-11-09 1417 if (!region_name) { 0700bc2fb94c28 Simon Trimmer 2021-09-13 1418 adsp_err(dsp, "Unknown region type: %d\n", cs_ctl->alg_region.type); b21acc1c370f72 Charles Keepax 2015-04-13 1419 return -EINVAL; b21acc1c370f72 Charles Keepax 2015-04-13 1420 } b21acc1c370f72 Charles Keepax 2015-04-13 1421 cb5b57a9a449ad Charles Keepax 2015-04-13 1422 switch (dsp->fw_ver) { cb5b57a9a449ad Charles Keepax 2015-04-13 1423 case 0: cb5b57a9a449ad Charles Keepax 2015-04-13 1424 case 1: 605391d0f4bfdf Richard Fitzgerald 2018-08-08 1425 snprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, "%s %s %x", 0700bc2fb94c28 Simon Trimmer 2021-09-13 1426 dsp->name, region_name, cs_ctl->alg_region.alg); ret = scnprintf(). Change snprintf() to scnprintf(). cb5b57a9a449ad Charles Keepax 2015-04-13 1427 break; 170b1e123f385e Wen Shi 2019-03-19 1428 case 2: 578194290d0bf8 Takashi Iwai 2020-03-13 1429 ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, 605391d0f4bfdf Richard Fitzgerald 2018-08-08 1430 "%s%c %.12s %x", dsp->name, *region_name, 0700bc2fb94c28 Simon Trimmer 2021-09-13 1431 wm_adsp_fw_text[dsp->fw], cs_ctl->alg_region.alg); 170b1e123f385e Wen Shi 2019-03-19 1432 break; 170b1e123f385e Wen Shi 2019-03-19 1433 default: 578194290d0bf8 Takashi Iwai 2020-03-13 1434 ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, 170b1e123f385e Wen Shi 2019-03-19 1435 "%s %.12s %x", dsp->name, 0700bc2fb94c28 Simon Trimmer 2021-09-13 1436 wm_adsp_fw_text[dsp->fw], cs_ctl->alg_region.alg); 170b1e123f385e Wen Shi 2019-03-19 1437 break; 170b1e123f385e Wen Shi 2019-03-19 1438 } cb5b57a9a449ad Charles Keepax 2015-04-13 1439 0700bc2fb94c28 Simon Trimmer 2021-09-13 1440 if (cs_ctl->subname) { cb5b57a9a449ad Charles Keepax 2015-04-13 @1441 int avail = SNDRV_CTL_ELEM_ID_NAME_MAXLEN - ret - 2; ^^^ cb5b57a9a449ad Charles Keepax 2015-04-13 1442 int skip = 0; cb5b57a9a449ad Charles Keepax 2015-04-13 1443 b7ede5af62ab6b Charles Keepax 2018-07-19 1444 if (dsp->component->name_prefix) b7ede5af62ab6b Charles Keepax 2018-07-19 1445 avail -= strlen(dsp->component->name_prefix) + 1; b7ede5af62ab6b Charles Keepax 2018-07-19 1446 170b1e123f385e Wen Shi 2019-03-19 1447 /* Truncate the subname from the start if it is too long */ 0700bc2fb94c28 Simon Trimmer 2021-09-13 1448 if (cs_ctl->subname_len > avail) 0700bc2fb94c28 Simon Trimmer 2021-09-13 1449 skip = cs_ctl->subname_len - avail; cb5b57a9a449ad Charles Keepax 2015-04-13 1450 170b1e123f385e Wen Shi 2019-03-19 1451 snprintf(name + ret, SNDRV_CTL_ELEM_ID_NAME_MAXLEN - ret, 0700bc2fb94c28 Simon Trimmer 2021-09-13 1452 " %.*s", cs_ctl->subname_len - skip, cs_ctl->subname + skip); cb5b57a9a449ad Charles Keepax 2015-04-13 1453 } b21acc1c370f72 Charles Keepax 2015-04-13 1454 b21acc1c370f72 Charles Keepax 2015-04-13 1455 ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); b21acc1c370f72 Charles Keepax 2015-04-13 1456 if (!ctl) b21acc1c370f72 Charles Keepax 2015-04-13 1457 return -ENOMEM; 0700bc2fb94c28 Simon Trimmer 2021-09-13 1458 ctl->cs_ctl = cs_ctl; 0700bc2fb94c28 Simon Trimmer 2021-09-13 1459 b21acc1c370f72 Charles Keepax 2015-04-13 1460 ctl->name = kmemdup(name, strlen(name) + 1, GFP_KERNEL); b21acc1c370f72 Charles Keepax 2015-04-13 1461 if (!ctl->name) { b21acc1c370f72 Charles Keepax 2015-04-13 1462 ret = -ENOMEM; b21acc1c370f72 Charles Keepax 2015-04-13 1463 goto err_ctl; b21acc1c370f72 Charles Keepax 2015-04-13 1464 } 0700bc2fb94c28 Simon Trimmer 2021-09-13 1465 0700bc2fb94c28 Simon Trimmer 2021-09-13 1466 cs_ctl->priv = ctl; 0700bc2fb94c28 Simon Trimmer 2021-09-13 1467 0700bc2fb94c28 Simon Trimmer 2021-09-13 1468 INIT_WORK(&ctl->work, wm_adsp_ctl_work); 0700bc2fb94c28 Simon Trimmer 2021-09-13 1469 schedule_work(&ctl->work); 0700bc2fb94c28 Simon Trimmer 2021-09-13 1470 0700bc2fb94c28 Simon Trimmer 2021-09-13 1471 return 0; 0700bc2fb94c28 Simon Trimmer 2021-09-13 1472 0700bc2fb94c28 Simon Trimmer 2021-09-13 1473 err_ctl: 0700bc2fb94c28 Simon Trimmer 2021-09-13 1474 kfree(ctl); 0700bc2fb94c28 Simon Trimmer 2021-09-13 1475 0700bc2fb94c28 Simon Trimmer 2021-09-13 1476 return ret; 0700bc2fb94c28 Simon Trimmer 2021-09-13 1477 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx