[alsa-devel] [asoc:topic/dapm 4/4] sound//soc/soc-dapm.c:3940:2: warning: 'w_param_text' may be used uninitialized in this function
kbuild test robot
fengguang.wu at intel.com
Thu Oct 5 21:59:13 CEST 2017
tree: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git topic/dapm
head: 19ad683abc8534cd755403381c73c0ddce7b9f6d
commit: 19ad683abc8534cd755403381c73c0ddce7b9f6d [4/4] ASoC: dapm: Avoid creating kcontrol for params
config: i386-randconfig-x079-201740 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
git checkout 19ad683abc8534cd755403381c73c0ddce7b9f6d
# save the attached .config to linux build tree
make ARCH=i386
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
sound//soc/soc-dapm.c: In function 'snd_soc_dapm_new_pcm':
>> sound//soc/soc-dapm.c:3940:2: warning: 'w_param_text' may be used uninitialized in this function [-Wmaybe-uninitialized]
snd_soc_dapm_free_kcontrol(card, &private_value, num_params, w_param_text);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/w_param_text +3940 sound//soc/soc-dapm.c
3862
3863 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
3864 const struct snd_soc_pcm_stream *params,
3865 unsigned int num_params,
3866 struct snd_soc_dapm_widget *source,
3867 struct snd_soc_dapm_widget *sink)
3868 {
3869 struct snd_soc_dapm_widget template;
3870 struct snd_soc_dapm_widget *w;
3871 const char **w_param_text;
3872 unsigned long private_value;
3873 char *link_name;
3874 int ret;
3875
3876 link_name = devm_kasprintf(card->dev, GFP_KERNEL, "%s-%s",
3877 source->name, sink->name);
3878 if (!link_name)
3879 return -ENOMEM;
3880
3881 memset(&template, 0, sizeof(template));
3882 template.reg = SND_SOC_NOPM;
3883 template.id = snd_soc_dapm_dai_link;
3884 template.name = link_name;
3885 template.event = snd_soc_dai_link_event;
3886 template.event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
3887 SND_SOC_DAPM_PRE_PMD;
3888 template.kcontrol_news = NULL;
3889
3890 /* allocate memory for control, only in case of multiple configs */
3891 if (num_params > 1) {
3892 w_param_text = devm_kcalloc(card->dev, num_params,
3893 sizeof(char *), GFP_KERNEL);
3894 if (!w_param_text) {
3895 ret = -ENOMEM;
3896 goto param_fail;
3897 }
3898
3899 template.num_kcontrols = 1;
3900 template.kcontrol_news =
3901 snd_soc_dapm_alloc_kcontrol(card,
3902 link_name, params, num_params,
3903 w_param_text, &private_value);
3904 if (!template.kcontrol_news) {
3905 ret = -ENOMEM;
3906 goto param_fail;
3907 }
3908 }
3909 dev_dbg(card->dev, "ASoC: adding %s widget\n", link_name);
3910
3911 w = snd_soc_dapm_new_control_unlocked(&card->dapm, &template);
3912 if (IS_ERR(w)) {
3913 ret = PTR_ERR(w);
3914 /* Do not nag about probe deferrals */
3915 if (ret != -EPROBE_DEFER)
3916 dev_err(card->dev,
3917 "ASoC: Failed to create %s widget (%d)\n",
3918 link_name, ret);
3919 goto outfree_kcontrol_news;
3920 }
3921 if (!w) {
3922 dev_err(card->dev, "ASoC: Failed to create %s widget\n",
3923 link_name);
3924 ret = -ENOMEM;
3925 goto outfree_kcontrol_news;
3926 }
3927
3928 w->params = params;
3929 w->num_params = num_params;
3930
3931 ret = snd_soc_dapm_add_path(&card->dapm, source, w, NULL, NULL);
3932 if (ret)
3933 goto outfree_w;
3934 return snd_soc_dapm_add_path(&card->dapm, w, sink, NULL, NULL);
3935
3936 outfree_w:
3937 devm_kfree(card->dev, w);
3938 outfree_kcontrol_news:
3939 devm_kfree(card->dev, (void *)template.kcontrol_news);
> 3940 snd_soc_dapm_free_kcontrol(card, &private_value, num_params, w_param_text);
3941 param_fail:
3942 devm_kfree(card->dev, link_name);
3943 return ret;
3944 }
3945
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 31095 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20171006/43127cbf/attachment-0001.bin>
More information about the Alsa-devel
mailing list