All of lore.kernel.org
 help / color / mirror / Atom feed
* [plbossart-sound:sdw/fix-rt711-sdca-entity 5016/5017] sound/soc/soc-topology.c:1560 soc_tplg_dapm_widget_create() error: uninitialized symbol 'kcontrol_type'.
@ 2021-05-07  5:51 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-05-07  5:51 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 15234 bytes --]

tree:   https://github.com/plbossart/sound sdw/fix-rt711-sdca-entity
head:   5d75f35655cc306c3b4eb57418099b2a0869850d
commit: 434aeb3af2157013f49275256a3a06a01573e29f [5016/5017] ASoC: dapm: Add support for multiple kcontrol types to a widget
config: i386-randconfig-m021-20210504 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
sound/soc/soc-topology.c:1560 soc_tplg_dapm_widget_create() error: uninitialized symbol 'kcontrol_type'.
sound/soc/soc-topology.c:1579 soc_tplg_dapm_widget_create() error: uninitialized symbol 'kc'.
sound/soc/soc-topology.c:1579 soc_tplg_dapm_widget_create() warn: passing devm_ allocated variable to kfree. 'kc'

vim +/kcontrol_type +1560 sound/soc/soc-topology.c

8a9782346dccd8 Liam Girdwood        2015-05-29  1419  
8a9782346dccd8 Liam Girdwood        2015-05-29  1420  static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
8a9782346dccd8 Liam Girdwood        2015-05-29  1421  	struct snd_soc_tplg_dapm_widget *w)
8a9782346dccd8 Liam Girdwood        2015-05-29  1422  {
8a9782346dccd8 Liam Girdwood        2015-05-29  1423  	struct snd_soc_dapm_context *dapm = &tplg->comp->dapm;
8a9782346dccd8 Liam Girdwood        2015-05-29  1424  	struct snd_soc_dapm_widget template, *widget;
8a9782346dccd8 Liam Girdwood        2015-05-29  1425  	struct snd_soc_tplg_ctl_hdr *control_hdr;
8a9782346dccd8 Liam Girdwood        2015-05-29  1426  	struct snd_soc_card *card = tplg->comp->card;
434aeb3af21570 Jaska Uimonen        2020-09-08  1427  	unsigned int *kcontrol_type;
434aeb3af21570 Jaska Uimonen        2020-09-08  1428  	struct snd_kcontrol_new *kc;
434aeb3af21570 Jaska Uimonen        2020-09-08  1429  	int mixer_count = 0;
434aeb3af21570 Jaska Uimonen        2020-09-08  1430  	int bytes_count = 0;
434aeb3af21570 Jaska Uimonen        2020-09-08  1431  	int enum_count = 0;
8a9782346dccd8 Liam Girdwood        2015-05-29  1432  	int ret = 0;
434aeb3af21570 Jaska Uimonen        2020-09-08  1433  	int i;
8a9782346dccd8 Liam Girdwood        2015-05-29  1434  
8a9782346dccd8 Liam Girdwood        2015-05-29  1435  	if (strnlen(w->name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) ==
8a9782346dccd8 Liam Girdwood        2015-05-29  1436  		SNDRV_CTL_ELEM_ID_NAME_MAXLEN)
8a9782346dccd8 Liam Girdwood        2015-05-29  1437  		return -EINVAL;
8a9782346dccd8 Liam Girdwood        2015-05-29  1438  	if (strnlen(w->sname, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) ==
8a9782346dccd8 Liam Girdwood        2015-05-29  1439  		SNDRV_CTL_ELEM_ID_NAME_MAXLEN)
8a9782346dccd8 Liam Girdwood        2015-05-29  1440  		return -EINVAL;
8a9782346dccd8 Liam Girdwood        2015-05-29  1441  
8a9782346dccd8 Liam Girdwood        2015-05-29  1442  	dev_dbg(tplg->dev, "ASoC: creating DAPM widget %s id %d\n",
8a9782346dccd8 Liam Girdwood        2015-05-29  1443  		w->name, w->id);
8a9782346dccd8 Liam Girdwood        2015-05-29  1444  
8a9782346dccd8 Liam Girdwood        2015-05-29  1445  	memset(&template, 0, sizeof(template));
8a9782346dccd8 Liam Girdwood        2015-05-29  1446  
8a9782346dccd8 Liam Girdwood        2015-05-29  1447  	/* map user to kernel widget ID */
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1448  	template.id = get_widget_id(le32_to_cpu(w->id));
752c938a5c14b8 Dan Carpenter        2019-09-25  1449  	if ((int)template.id < 0)
8a9782346dccd8 Liam Girdwood        2015-05-29  1450  		return template.id;
8a9782346dccd8 Liam Girdwood        2015-05-29  1451  
c3421a6a65abc6 Liam Girdwood        2017-06-06  1452  	/* strings are allocated here, but used and freed by the widget */
8a9782346dccd8 Liam Girdwood        2015-05-29  1453  	template.name = kstrdup(w->name, GFP_KERNEL);
8a9782346dccd8 Liam Girdwood        2015-05-29  1454  	if (!template.name)
8a9782346dccd8 Liam Girdwood        2015-05-29  1455  		return -ENOMEM;
8a9782346dccd8 Liam Girdwood        2015-05-29  1456  	template.sname = kstrdup(w->sname, GFP_KERNEL);
8a9782346dccd8 Liam Girdwood        2015-05-29  1457  	if (!template.sname) {
8a9782346dccd8 Liam Girdwood        2015-05-29  1458  		ret = -ENOMEM;
8a9782346dccd8 Liam Girdwood        2015-05-29  1459  		goto err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1460  	}
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1461  	template.reg = le32_to_cpu(w->reg);
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1462  	template.shift = le32_to_cpu(w->shift);
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1463  	template.mask = le32_to_cpu(w->mask);
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1464  	template.subseq = le32_to_cpu(w->subseq);
8a9782346dccd8 Liam Girdwood        2015-05-29  1465  	template.on_val = w->invert ? 0 : 1;
8a9782346dccd8 Liam Girdwood        2015-05-29  1466  	template.off_val = w->invert ? 1 : 0;
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1467  	template.ignore_suspend = le32_to_cpu(w->ignore_suspend);
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1468  	template.event_flags = le16_to_cpu(w->event_flags);
8a9782346dccd8 Liam Girdwood        2015-05-29  1469  	template.dobj.index = tplg->index;
8a9782346dccd8 Liam Girdwood        2015-05-29  1470  
8a9782346dccd8 Liam Girdwood        2015-05-29  1471  	tplg->pos +=
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1472  		(sizeof(struct snd_soc_tplg_dapm_widget) +
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1473  		 le32_to_cpu(w->priv.size));
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1474  
8a9782346dccd8 Liam Girdwood        2015-05-29  1475  	if (w->num_kcontrols == 0) {
8a9782346dccd8 Liam Girdwood        2015-05-29  1476  		template.num_kcontrols = 0;
8a9782346dccd8 Liam Girdwood        2015-05-29  1477  		goto widget;
8a9782346dccd8 Liam Girdwood        2015-05-29  1478  	}
8a9782346dccd8 Liam Girdwood        2015-05-29  1479  
8a9782346dccd8 Liam Girdwood        2015-05-29  1480  	control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos;
8a9782346dccd8 Liam Girdwood        2015-05-29  1481  	dev_dbg(tplg->dev, "ASoC: template %s has %d controls of type %x\n",
8a9782346dccd8 Liam Girdwood        2015-05-29  1482  		w->name, w->num_kcontrols, control_hdr->type);
8a9782346dccd8 Liam Girdwood        2015-05-29  1483  
434aeb3af21570 Jaska Uimonen        2020-09-08  1484  	template.num_kcontrols = le32_to_cpu(w->num_kcontrols);
434aeb3af21570 Jaska Uimonen        2020-09-08  1485  	kc = devm_kcalloc(tplg->dev, w->num_kcontrols, sizeof(*kc), GFP_KERNEL);
434aeb3af21570 Jaska Uimonen        2020-09-08  1486  	if (!kc)
434aeb3af21570 Jaska Uimonen        2020-09-08  1487  		goto err;
434aeb3af21570 Jaska Uimonen        2020-09-08  1488  
434aeb3af21570 Jaska Uimonen        2020-09-08  1489  	kcontrol_type = devm_kcalloc(tplg->dev, w->num_kcontrols, sizeof(unsigned int), GFP_KERNEL);
434aeb3af21570 Jaska Uimonen        2020-09-08  1490  	if (!kcontrol_type)
434aeb3af21570 Jaska Uimonen        2020-09-08  1491  		goto err;
434aeb3af21570 Jaska Uimonen        2020-09-08  1492  
434aeb3af21570 Jaska Uimonen        2020-09-08  1493  	for (i = 0; i < w->num_kcontrols; i++) {
434aeb3af21570 Jaska Uimonen        2020-09-08  1494  		control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos;
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1495  		switch (le32_to_cpu(control_hdr->ops.info)) {
8a9782346dccd8 Liam Girdwood        2015-05-29  1496  		case SND_SOC_TPLG_CTL_VOLSW:
8a9782346dccd8 Liam Girdwood        2015-05-29  1497  		case SND_SOC_TPLG_CTL_STROBE:
8a9782346dccd8 Liam Girdwood        2015-05-29  1498  		case SND_SOC_TPLG_CTL_VOLSW_SX:
8a9782346dccd8 Liam Girdwood        2015-05-29  1499  		case SND_SOC_TPLG_CTL_VOLSW_XR_SX:
8a9782346dccd8 Liam Girdwood        2015-05-29  1500  		case SND_SOC_TPLG_CTL_RANGE:
8a9782346dccd8 Liam Girdwood        2015-05-29  1501  		case SND_SOC_TPLG_DAPM_CTL_VOLSW:
434aeb3af21570 Jaska Uimonen        2020-09-08  1502  			/* volume mixer */
434aeb3af21570 Jaska Uimonen        2020-09-08  1503  			kc[i].index = mixer_count;
434aeb3af21570 Jaska Uimonen        2020-09-08  1504  			kcontrol_type[i] = SND_SOC_TPLG_TYPE_MIXER;
434aeb3af21570 Jaska Uimonen        2020-09-08  1505  			mixer_count++;
434aeb3af21570 Jaska Uimonen        2020-09-08  1506  			ret = soc_tplg_dapm_widget_dmixer_create(tplg, &kc[i]);
434aeb3af21570 Jaska Uimonen        2020-09-08  1507  			if (ret < 0)
8a9782346dccd8 Liam Girdwood        2015-05-29  1508  				goto hdr_err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1509  			break;
8a9782346dccd8 Liam Girdwood        2015-05-29  1510  		case SND_SOC_TPLG_CTL_ENUM:
8a9782346dccd8 Liam Girdwood        2015-05-29  1511  		case SND_SOC_TPLG_CTL_ENUM_VALUE:
8a9782346dccd8 Liam Girdwood        2015-05-29  1512  		case SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE:
8a9782346dccd8 Liam Girdwood        2015-05-29  1513  		case SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT:
8a9782346dccd8 Liam Girdwood        2015-05-29  1514  		case SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE:
434aeb3af21570 Jaska Uimonen        2020-09-08  1515  			/* enumerated mixer */
434aeb3af21570 Jaska Uimonen        2020-09-08  1516  			kc[i].index = enum_count;
434aeb3af21570 Jaska Uimonen        2020-09-08  1517  			kcontrol_type[i] = SND_SOC_TPLG_TYPE_ENUM;
434aeb3af21570 Jaska Uimonen        2020-09-08  1518  			enum_count++;
434aeb3af21570 Jaska Uimonen        2020-09-08  1519  			ret = soc_tplg_dapm_widget_denum_create(tplg, &kc[i]);
434aeb3af21570 Jaska Uimonen        2020-09-08  1520  			if (ret < 0)
8a9782346dccd8 Liam Girdwood        2015-05-29  1521  				goto hdr_err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1522  			break;
8a9782346dccd8 Liam Girdwood        2015-05-29  1523  		case SND_SOC_TPLG_CTL_BYTES:
434aeb3af21570 Jaska Uimonen        2020-09-08  1524  			/* bytes control */
434aeb3af21570 Jaska Uimonen        2020-09-08  1525  			kc[i].index = bytes_count;
434aeb3af21570 Jaska Uimonen        2020-09-08  1526  			kcontrol_type[i] = SND_SOC_TPLG_TYPE_BYTES;
434aeb3af21570 Jaska Uimonen        2020-09-08  1527  			bytes_count++;
434aeb3af21570 Jaska Uimonen        2020-09-08  1528  			ret = soc_tplg_dapm_widget_dbytes_create(tplg, &kc[i]);
434aeb3af21570 Jaska Uimonen        2020-09-08  1529  			if (ret < 0)
8a9782346dccd8 Liam Girdwood        2015-05-29  1530  				goto hdr_err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1531  			break;
8a9782346dccd8 Liam Girdwood        2015-05-29  1532  		default:
8a9782346dccd8 Liam Girdwood        2015-05-29  1533  			dev_err(tplg->dev, "ASoC: invalid widget control type %d:%d:%d\n",
8a9782346dccd8 Liam Girdwood        2015-05-29  1534  				control_hdr->ops.get, control_hdr->ops.put,
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1535  				le32_to_cpu(control_hdr->ops.info));
8a9782346dccd8 Liam Girdwood        2015-05-29  1536  			ret = -EINVAL;
8a9782346dccd8 Liam Girdwood        2015-05-29  1537  			goto hdr_err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1538  		}
434aeb3af21570 Jaska Uimonen        2020-09-08  1539  	}
434aeb3af21570 Jaska Uimonen        2020-09-08  1540  
434aeb3af21570 Jaska Uimonen        2020-09-08  1541  	template.kcontrol_news = kc;
8a9782346dccd8 Liam Girdwood        2015-05-29  1542  
8a9782346dccd8 Liam Girdwood        2015-05-29  1543  widget:
8a9782346dccd8 Liam Girdwood        2015-05-29  1544  	ret = soc_tplg_widget_load(tplg, &template, w);
8a9782346dccd8 Liam Girdwood        2015-05-29  1545  	if (ret < 0)
8a9782346dccd8 Liam Girdwood        2015-05-29  1546  		goto hdr_err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1547  
8a9782346dccd8 Liam Girdwood        2015-05-29  1548  	/* card dapm mutex is held by the core if we are loading topology
8a9782346dccd8 Liam Girdwood        2015-05-29  1549  	 * data during sound card init. */
8a9782346dccd8 Liam Girdwood        2015-05-29  1550  	if (card->instantiated)
8a9782346dccd8 Liam Girdwood        2015-05-29  1551  		widget = snd_soc_dapm_new_control(dapm, &template);
8a9782346dccd8 Liam Girdwood        2015-05-29  1552  	else
8a9782346dccd8 Liam Girdwood        2015-05-29  1553  		widget = snd_soc_dapm_new_control_unlocked(dapm, &template);
37e1df8c95e2c8 Linus Walleij        2017-01-13  1554  	if (IS_ERR(widget)) {
37e1df8c95e2c8 Linus Walleij        2017-01-13  1555  		ret = PTR_ERR(widget);
8a9782346dccd8 Liam Girdwood        2015-05-29  1556  		goto hdr_err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1557  	}
8a9782346dccd8 Liam Girdwood        2015-05-29  1558  
8a9782346dccd8 Liam Girdwood        2015-05-29  1559  	widget->dobj.type = SND_SOC_DOBJ_WIDGET;
eea3dd4f1247aa Mengdong Lin         2016-11-25 @1560  	widget->dobj.widget.kcontrol_type = kcontrol_type;
8a9782346dccd8 Liam Girdwood        2015-05-29  1561  	widget->dobj.ops = tplg->ops;
8a9782346dccd8 Liam Girdwood        2015-05-29  1562  	widget->dobj.index = tplg->index;
8a9782346dccd8 Liam Girdwood        2015-05-29  1563  	list_add(&widget->dobj.list, &tplg->comp->dobj_list);
ebd259d33a900b Liam Girdwood        2017-06-09  1564  
ebd259d33a900b Liam Girdwood        2017-06-09  1565  	ret = soc_tplg_widget_ready(tplg, widget, w);
ebd259d33a900b Liam Girdwood        2017-06-09  1566  	if (ret < 0)
ebd259d33a900b Liam Girdwood        2017-06-09  1567  		goto ready_err;
ebd259d33a900b Liam Girdwood        2017-06-09  1568  
7620fe9161cec2 Bard liao            2019-01-25  1569  	kfree(template.sname);
7620fe9161cec2 Bard liao            2019-01-25  1570  	kfree(template.name);
7620fe9161cec2 Bard liao            2019-01-25  1571  
8a9782346dccd8 Liam Girdwood        2015-05-29  1572  	return 0;
8a9782346dccd8 Liam Girdwood        2015-05-29  1573  
ebd259d33a900b Liam Girdwood        2017-06-09  1574  ready_err:
841fb1096713bd Amadeusz Sławiński   2020-10-30  1575  	remove_widget(widget->dapm->component, &widget->dobj, SOC_TPLG_PASS_WIDGET);
ebd259d33a900b Liam Girdwood        2017-06-09  1576  	snd_soc_dapm_free_widget(widget);
8a9782346dccd8 Liam Girdwood        2015-05-29  1577  hdr_err:
8a9782346dccd8 Liam Girdwood        2015-05-29  1578  	kfree(template.sname);
434aeb3af21570 Jaska Uimonen        2020-09-08 @1579  	kfree(kc);
8a9782346dccd8 Liam Girdwood        2015-05-29  1580  err:
8a9782346dccd8 Liam Girdwood        2015-05-29  1581  	kfree(template.name);
8a9782346dccd8 Liam Girdwood        2015-05-29  1582  	return ret;
8a9782346dccd8 Liam Girdwood        2015-05-29  1583  }
8a9782346dccd8 Liam Girdwood        2015-05-29  1584  

:::::: The code at line 1560 was first introduced by commit
:::::: eea3dd4f1247aa8654194fb19ade22c94c42e41a ASoC: topology: Only free TLV for volume mixers of a widget

:::::: TO: Mengdong Lin <mengdong.lin@linux.intel.com>
:::::: CC: Mark Brown <broonie@kernel.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39363 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [plbossart-sound:sdw/fix-rt711-sdca-entity 5016/5017] sound/soc/soc-topology.c:1560 soc_tplg_dapm_widget_create() error: uninitialized symbol 'kcontrol_type'.
@ 2021-05-04 20:15 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-05-04 20:15 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 15280 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Jaska Uimonen <jaska.uimonen@linux.intel.com>
CC: Ranjani Sridharan <ranjani.sridharan@intel.com>

tree:   https://github.com/plbossart/sound sdw/fix-rt711-sdca-entity
head:   5d75f35655cc306c3b4eb57418099b2a0869850d
commit: 434aeb3af2157013f49275256a3a06a01573e29f [5016/5017] ASoC: dapm: Add support for multiple kcontrol types to a widget
:::::: branch date: 4 hours ago
:::::: commit date: 26 hours ago
config: i386-randconfig-m021-20210504 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
sound/soc/soc-topology.c:1560 soc_tplg_dapm_widget_create() error: uninitialized symbol 'kcontrol_type'.
sound/soc/soc-topology.c:1579 soc_tplg_dapm_widget_create() error: uninitialized symbol 'kc'.
sound/soc/soc-topology.c:1579 soc_tplg_dapm_widget_create() warn: passing devm_ allocated variable to kfree. 'kc'

vim +/kcontrol_type +1560 sound/soc/soc-topology.c

8a9782346dccd8 Liam Girdwood        2015-05-29  1419  
8a9782346dccd8 Liam Girdwood        2015-05-29  1420  static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
8a9782346dccd8 Liam Girdwood        2015-05-29  1421  	struct snd_soc_tplg_dapm_widget *w)
8a9782346dccd8 Liam Girdwood        2015-05-29  1422  {
8a9782346dccd8 Liam Girdwood        2015-05-29  1423  	struct snd_soc_dapm_context *dapm = &tplg->comp->dapm;
8a9782346dccd8 Liam Girdwood        2015-05-29  1424  	struct snd_soc_dapm_widget template, *widget;
8a9782346dccd8 Liam Girdwood        2015-05-29  1425  	struct snd_soc_tplg_ctl_hdr *control_hdr;
8a9782346dccd8 Liam Girdwood        2015-05-29  1426  	struct snd_soc_card *card = tplg->comp->card;
434aeb3af21570 Jaska Uimonen        2020-09-08  1427  	unsigned int *kcontrol_type;
434aeb3af21570 Jaska Uimonen        2020-09-08  1428  	struct snd_kcontrol_new *kc;
434aeb3af21570 Jaska Uimonen        2020-09-08  1429  	int mixer_count = 0;
434aeb3af21570 Jaska Uimonen        2020-09-08  1430  	int bytes_count = 0;
434aeb3af21570 Jaska Uimonen        2020-09-08  1431  	int enum_count = 0;
8a9782346dccd8 Liam Girdwood        2015-05-29  1432  	int ret = 0;
434aeb3af21570 Jaska Uimonen        2020-09-08  1433  	int i;
8a9782346dccd8 Liam Girdwood        2015-05-29  1434  
8a9782346dccd8 Liam Girdwood        2015-05-29  1435  	if (strnlen(w->name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) ==
8a9782346dccd8 Liam Girdwood        2015-05-29  1436  		SNDRV_CTL_ELEM_ID_NAME_MAXLEN)
8a9782346dccd8 Liam Girdwood        2015-05-29  1437  		return -EINVAL;
8a9782346dccd8 Liam Girdwood        2015-05-29  1438  	if (strnlen(w->sname, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) ==
8a9782346dccd8 Liam Girdwood        2015-05-29  1439  		SNDRV_CTL_ELEM_ID_NAME_MAXLEN)
8a9782346dccd8 Liam Girdwood        2015-05-29  1440  		return -EINVAL;
8a9782346dccd8 Liam Girdwood        2015-05-29  1441  
8a9782346dccd8 Liam Girdwood        2015-05-29  1442  	dev_dbg(tplg->dev, "ASoC: creating DAPM widget %s id %d\n",
8a9782346dccd8 Liam Girdwood        2015-05-29  1443  		w->name, w->id);
8a9782346dccd8 Liam Girdwood        2015-05-29  1444  
8a9782346dccd8 Liam Girdwood        2015-05-29  1445  	memset(&template, 0, sizeof(template));
8a9782346dccd8 Liam Girdwood        2015-05-29  1446  
8a9782346dccd8 Liam Girdwood        2015-05-29  1447  	/* map user to kernel widget ID */
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1448  	template.id = get_widget_id(le32_to_cpu(w->id));
752c938a5c14b8 Dan Carpenter        2019-09-25  1449  	if ((int)template.id < 0)
8a9782346dccd8 Liam Girdwood        2015-05-29  1450  		return template.id;
8a9782346dccd8 Liam Girdwood        2015-05-29  1451  
c3421a6a65abc6 Liam Girdwood        2017-06-06  1452  	/* strings are allocated here, but used and freed by the widget */
8a9782346dccd8 Liam Girdwood        2015-05-29  1453  	template.name = kstrdup(w->name, GFP_KERNEL);
8a9782346dccd8 Liam Girdwood        2015-05-29  1454  	if (!template.name)
8a9782346dccd8 Liam Girdwood        2015-05-29  1455  		return -ENOMEM;
8a9782346dccd8 Liam Girdwood        2015-05-29  1456  	template.sname = kstrdup(w->sname, GFP_KERNEL);
8a9782346dccd8 Liam Girdwood        2015-05-29  1457  	if (!template.sname) {
8a9782346dccd8 Liam Girdwood        2015-05-29  1458  		ret = -ENOMEM;
8a9782346dccd8 Liam Girdwood        2015-05-29  1459  		goto err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1460  	}
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1461  	template.reg = le32_to_cpu(w->reg);
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1462  	template.shift = le32_to_cpu(w->shift);
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1463  	template.mask = le32_to_cpu(w->mask);
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1464  	template.subseq = le32_to_cpu(w->subseq);
8a9782346dccd8 Liam Girdwood        2015-05-29  1465  	template.on_val = w->invert ? 0 : 1;
8a9782346dccd8 Liam Girdwood        2015-05-29  1466  	template.off_val = w->invert ? 1 : 0;
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1467  	template.ignore_suspend = le32_to_cpu(w->ignore_suspend);
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1468  	template.event_flags = le16_to_cpu(w->event_flags);
8a9782346dccd8 Liam Girdwood        2015-05-29  1469  	template.dobj.index = tplg->index;
8a9782346dccd8 Liam Girdwood        2015-05-29  1470  
8a9782346dccd8 Liam Girdwood        2015-05-29  1471  	tplg->pos +=
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1472  		(sizeof(struct snd_soc_tplg_dapm_widget) +
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1473  		 le32_to_cpu(w->priv.size));
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1474  
8a9782346dccd8 Liam Girdwood        2015-05-29  1475  	if (w->num_kcontrols == 0) {
8a9782346dccd8 Liam Girdwood        2015-05-29  1476  		template.num_kcontrols = 0;
8a9782346dccd8 Liam Girdwood        2015-05-29  1477  		goto widget;
8a9782346dccd8 Liam Girdwood        2015-05-29  1478  	}
8a9782346dccd8 Liam Girdwood        2015-05-29  1479  
8a9782346dccd8 Liam Girdwood        2015-05-29  1480  	control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos;
8a9782346dccd8 Liam Girdwood        2015-05-29  1481  	dev_dbg(tplg->dev, "ASoC: template %s has %d controls of type %x\n",
8a9782346dccd8 Liam Girdwood        2015-05-29  1482  		w->name, w->num_kcontrols, control_hdr->type);
8a9782346dccd8 Liam Girdwood        2015-05-29  1483  
434aeb3af21570 Jaska Uimonen        2020-09-08  1484  	template.num_kcontrols = le32_to_cpu(w->num_kcontrols);
434aeb3af21570 Jaska Uimonen        2020-09-08  1485  	kc = devm_kcalloc(tplg->dev, w->num_kcontrols, sizeof(*kc), GFP_KERNEL);
434aeb3af21570 Jaska Uimonen        2020-09-08  1486  	if (!kc)
434aeb3af21570 Jaska Uimonen        2020-09-08  1487  		goto err;
434aeb3af21570 Jaska Uimonen        2020-09-08  1488  
434aeb3af21570 Jaska Uimonen        2020-09-08  1489  	kcontrol_type = devm_kcalloc(tplg->dev, w->num_kcontrols, sizeof(unsigned int), GFP_KERNEL);
434aeb3af21570 Jaska Uimonen        2020-09-08  1490  	if (!kcontrol_type)
434aeb3af21570 Jaska Uimonen        2020-09-08  1491  		goto err;
434aeb3af21570 Jaska Uimonen        2020-09-08  1492  
434aeb3af21570 Jaska Uimonen        2020-09-08  1493  	for (i = 0; i < w->num_kcontrols; i++) {
434aeb3af21570 Jaska Uimonen        2020-09-08  1494  		control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos;
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1495  		switch (le32_to_cpu(control_hdr->ops.info)) {
8a9782346dccd8 Liam Girdwood        2015-05-29  1496  		case SND_SOC_TPLG_CTL_VOLSW:
8a9782346dccd8 Liam Girdwood        2015-05-29  1497  		case SND_SOC_TPLG_CTL_STROBE:
8a9782346dccd8 Liam Girdwood        2015-05-29  1498  		case SND_SOC_TPLG_CTL_VOLSW_SX:
8a9782346dccd8 Liam Girdwood        2015-05-29  1499  		case SND_SOC_TPLG_CTL_VOLSW_XR_SX:
8a9782346dccd8 Liam Girdwood        2015-05-29  1500  		case SND_SOC_TPLG_CTL_RANGE:
8a9782346dccd8 Liam Girdwood        2015-05-29  1501  		case SND_SOC_TPLG_DAPM_CTL_VOLSW:
434aeb3af21570 Jaska Uimonen        2020-09-08  1502  			/* volume mixer */
434aeb3af21570 Jaska Uimonen        2020-09-08  1503  			kc[i].index = mixer_count;
434aeb3af21570 Jaska Uimonen        2020-09-08  1504  			kcontrol_type[i] = SND_SOC_TPLG_TYPE_MIXER;
434aeb3af21570 Jaska Uimonen        2020-09-08  1505  			mixer_count++;
434aeb3af21570 Jaska Uimonen        2020-09-08  1506  			ret = soc_tplg_dapm_widget_dmixer_create(tplg, &kc[i]);
434aeb3af21570 Jaska Uimonen        2020-09-08  1507  			if (ret < 0)
8a9782346dccd8 Liam Girdwood        2015-05-29  1508  				goto hdr_err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1509  			break;
8a9782346dccd8 Liam Girdwood        2015-05-29  1510  		case SND_SOC_TPLG_CTL_ENUM:
8a9782346dccd8 Liam Girdwood        2015-05-29  1511  		case SND_SOC_TPLG_CTL_ENUM_VALUE:
8a9782346dccd8 Liam Girdwood        2015-05-29  1512  		case SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE:
8a9782346dccd8 Liam Girdwood        2015-05-29  1513  		case SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT:
8a9782346dccd8 Liam Girdwood        2015-05-29  1514  		case SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE:
434aeb3af21570 Jaska Uimonen        2020-09-08  1515  			/* enumerated mixer */
434aeb3af21570 Jaska Uimonen        2020-09-08  1516  			kc[i].index = enum_count;
434aeb3af21570 Jaska Uimonen        2020-09-08  1517  			kcontrol_type[i] = SND_SOC_TPLG_TYPE_ENUM;
434aeb3af21570 Jaska Uimonen        2020-09-08  1518  			enum_count++;
434aeb3af21570 Jaska Uimonen        2020-09-08  1519  			ret = soc_tplg_dapm_widget_denum_create(tplg, &kc[i]);
434aeb3af21570 Jaska Uimonen        2020-09-08  1520  			if (ret < 0)
8a9782346dccd8 Liam Girdwood        2015-05-29  1521  				goto hdr_err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1522  			break;
8a9782346dccd8 Liam Girdwood        2015-05-29  1523  		case SND_SOC_TPLG_CTL_BYTES:
434aeb3af21570 Jaska Uimonen        2020-09-08  1524  			/* bytes control */
434aeb3af21570 Jaska Uimonen        2020-09-08  1525  			kc[i].index = bytes_count;
434aeb3af21570 Jaska Uimonen        2020-09-08  1526  			kcontrol_type[i] = SND_SOC_TPLG_TYPE_BYTES;
434aeb3af21570 Jaska Uimonen        2020-09-08  1527  			bytes_count++;
434aeb3af21570 Jaska Uimonen        2020-09-08  1528  			ret = soc_tplg_dapm_widget_dbytes_create(tplg, &kc[i]);
434aeb3af21570 Jaska Uimonen        2020-09-08  1529  			if (ret < 0)
8a9782346dccd8 Liam Girdwood        2015-05-29  1530  				goto hdr_err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1531  			break;
8a9782346dccd8 Liam Girdwood        2015-05-29  1532  		default:
8a9782346dccd8 Liam Girdwood        2015-05-29  1533  			dev_err(tplg->dev, "ASoC: invalid widget control type %d:%d:%d\n",
8a9782346dccd8 Liam Girdwood        2015-05-29  1534  				control_hdr->ops.get, control_hdr->ops.put,
5aebe7c7f9c20e Pierre-Louis Bossart 2019-04-04  1535  				le32_to_cpu(control_hdr->ops.info));
8a9782346dccd8 Liam Girdwood        2015-05-29  1536  			ret = -EINVAL;
8a9782346dccd8 Liam Girdwood        2015-05-29  1537  			goto hdr_err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1538  		}
434aeb3af21570 Jaska Uimonen        2020-09-08  1539  	}
434aeb3af21570 Jaska Uimonen        2020-09-08  1540  
434aeb3af21570 Jaska Uimonen        2020-09-08  1541  	template.kcontrol_news = kc;
8a9782346dccd8 Liam Girdwood        2015-05-29  1542  
8a9782346dccd8 Liam Girdwood        2015-05-29  1543  widget:
8a9782346dccd8 Liam Girdwood        2015-05-29  1544  	ret = soc_tplg_widget_load(tplg, &template, w);
8a9782346dccd8 Liam Girdwood        2015-05-29  1545  	if (ret < 0)
8a9782346dccd8 Liam Girdwood        2015-05-29  1546  		goto hdr_err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1547  
8a9782346dccd8 Liam Girdwood        2015-05-29  1548  	/* card dapm mutex is held by the core if we are loading topology
8a9782346dccd8 Liam Girdwood        2015-05-29  1549  	 * data during sound card init. */
8a9782346dccd8 Liam Girdwood        2015-05-29  1550  	if (card->instantiated)
8a9782346dccd8 Liam Girdwood        2015-05-29  1551  		widget = snd_soc_dapm_new_control(dapm, &template);
8a9782346dccd8 Liam Girdwood        2015-05-29  1552  	else
8a9782346dccd8 Liam Girdwood        2015-05-29  1553  		widget = snd_soc_dapm_new_control_unlocked(dapm, &template);
37e1df8c95e2c8 Linus Walleij        2017-01-13  1554  	if (IS_ERR(widget)) {
37e1df8c95e2c8 Linus Walleij        2017-01-13  1555  		ret = PTR_ERR(widget);
8a9782346dccd8 Liam Girdwood        2015-05-29  1556  		goto hdr_err;
8a9782346dccd8 Liam Girdwood        2015-05-29  1557  	}
8a9782346dccd8 Liam Girdwood        2015-05-29  1558  
8a9782346dccd8 Liam Girdwood        2015-05-29  1559  	widget->dobj.type = SND_SOC_DOBJ_WIDGET;
eea3dd4f1247aa Mengdong Lin         2016-11-25 @1560  	widget->dobj.widget.kcontrol_type = kcontrol_type;
8a9782346dccd8 Liam Girdwood        2015-05-29  1561  	widget->dobj.ops = tplg->ops;
8a9782346dccd8 Liam Girdwood        2015-05-29  1562  	widget->dobj.index = tplg->index;
8a9782346dccd8 Liam Girdwood        2015-05-29  1563  	list_add(&widget->dobj.list, &tplg->comp->dobj_list);
ebd259d33a900b Liam Girdwood        2017-06-09  1564  
ebd259d33a900b Liam Girdwood        2017-06-09  1565  	ret = soc_tplg_widget_ready(tplg, widget, w);
ebd259d33a900b Liam Girdwood        2017-06-09  1566  	if (ret < 0)
ebd259d33a900b Liam Girdwood        2017-06-09  1567  		goto ready_err;
ebd259d33a900b Liam Girdwood        2017-06-09  1568  
7620fe9161cec2 Bard liao            2019-01-25  1569  	kfree(template.sname);
7620fe9161cec2 Bard liao            2019-01-25  1570  	kfree(template.name);
7620fe9161cec2 Bard liao            2019-01-25  1571  
8a9782346dccd8 Liam Girdwood        2015-05-29  1572  	return 0;
8a9782346dccd8 Liam Girdwood        2015-05-29  1573  
ebd259d33a900b Liam Girdwood        2017-06-09  1574  ready_err:
841fb1096713bd Amadeusz Sławiński   2020-10-30  1575  	remove_widget(widget->dapm->component, &widget->dobj, SOC_TPLG_PASS_WIDGET);
ebd259d33a900b Liam Girdwood        2017-06-09  1576  	snd_soc_dapm_free_widget(widget);
8a9782346dccd8 Liam Girdwood        2015-05-29  1577  hdr_err:
8a9782346dccd8 Liam Girdwood        2015-05-29  1578  	kfree(template.sname);
434aeb3af21570 Jaska Uimonen        2020-09-08 @1579  	kfree(kc);
8a9782346dccd8 Liam Girdwood        2015-05-29  1580  err:
8a9782346dccd8 Liam Girdwood        2015-05-29  1581  	kfree(template.name);
8a9782346dccd8 Liam Girdwood        2015-05-29  1582  	return ret;
8a9782346dccd8 Liam Girdwood        2015-05-29  1583  }
8a9782346dccd8 Liam Girdwood        2015-05-29  1584  

:::::: The code at line 1560 was first introduced by commit
:::::: eea3dd4f1247aa8654194fb19ade22c94c42e41a ASoC: topology: Only free TLV for volume mixers of a widget

:::::: TO: Mengdong Lin <mengdong.lin@linux.intel.com>
:::::: CC: Mark Brown <broonie@kernel.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39363 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-07  5:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07  5:51 [plbossart-sound:sdw/fix-rt711-sdca-entity 5016/5017] sound/soc/soc-topology.c:1560 soc_tplg_dapm_widget_create() error: uninitialized symbol 'kcontrol_type' kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-05-04 20:15 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.