Skip to contentSkip to conversation

sound/soc/soc-compress.c:75:28: warning: 'component' is used uninitialized in this function

PATCH Superseded kbuild test robot 4 participants 12 messages Apr 20, 2020 – Apr 24, 2020

Subsystems (3)
lore
Share & tools
lore

kbuild test robot

author build bot
#0 lore raw

Hi Kuninori,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7a56db0299f9d43b4fe076838150c5cc293df131
commit: 613fb50059cf19aa6acbc503a00265d9151c0b09 ASoC: soc-core: remove snd_soc_rtdcom_list
date:   3 months ago
config: i386-randconfig-a002-20200420 (attached as .config)
compiler: gcc-6 (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
reproduce:
        git checkout 613fb50059cf19aa6acbc503a00265d9151c0b09
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

sound/soc/soc-compress.c: In function 'soc_compr_open':

>> sound/soc/soc-compress.c:75:28: warning: 'component' is used uninitialized in this function [-Wuninitialized]
     struct snd_soc_component *component, *save = NULL;
                               ^~~~~~~~~

vim +/component +75 sound/soc/soc-compress.c

1e57b82891ade3 Charles Keepax     2018-04-24   71  
1e57b82891ade3 Charles Keepax     2018-04-24   72  static int soc_compr_open(struct snd_compr_stream *cstream)
1e57b82891ade3 Charles Keepax     2018-04-24   73  {
1e57b82891ade3 Charles Keepax     2018-04-24   74  	struct snd_soc_pcm_runtime *rtd = cstream->private_data;
4137f4b65df760 Cezary Rojewski    2019-12-17  @75  	struct snd_soc_component *component, *save = NULL;
1e57b82891ade3 Charles Keepax     2018-04-24   76  	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
613fb50059cf19 Kuninori Morimoto  2020-01-10   77  	int ret, i;
1e57b82891ade3 Charles Keepax     2018-04-24   78  
613fb50059cf19 Kuninori Morimoto  2020-01-10   79  	for_each_rtd_components(rtd, i, component) {
4137f4b65df760 Cezary Rojewski    2019-12-17   80  		ret = pm_runtime_get_sync(component->dev);
4137f4b65df760 Cezary Rojewski    2019-12-17   81  		if (ret < 0 && ret != -EACCES) {
4137f4b65df760 Cezary Rojewski    2019-12-17   82  			pm_runtime_put_noidle(component->dev);
4137f4b65df760 Cezary Rojewski    2019-12-17   83  			save = component;
4137f4b65df760 Cezary Rojewski    2019-12-17   84  			goto pm_err;
4137f4b65df760 Cezary Rojewski    2019-12-17   85  		}
4137f4b65df760 Cezary Rojewski    2019-12-17   86  	}
4137f4b65df760 Cezary Rojewski    2019-12-17   87  
72b745e3ad65de Peter Ujfalusi     2019-08-13   88  	mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
1e57b82891ade3 Charles Keepax     2018-04-24   89  
1e57b82891ade3 Charles Keepax     2018-04-24   90  	if (cpu_dai->driver->cops && cpu_dai->driver->cops->startup) {
1e57b82891ade3 Charles Keepax     2018-04-24   91  		ret = cpu_dai->driver->cops->startup(cstream, cpu_dai);
1e57b82891ade3 Charles Keepax     2018-04-24   92  		if (ret < 0) {
1e57b82891ade3 Charles Keepax     2018-04-24   93  			dev_err(cpu_dai->dev,
1e57b82891ade3 Charles Keepax     2018-04-24   94  				"Compress ASoC: can't open interface %s: %d\n",
1e57b82891ade3 Charles Keepax     2018-04-24   95  				cpu_dai->name, ret);
1e57b82891ade3 Charles Keepax     2018-04-24   96  			goto out;
1e57b82891ade3 Charles Keepax     2018-04-24   97  		}
1e57b82891ade3 Charles Keepax     2018-04-24   98  	}
1e57b82891ade3 Charles Keepax     2018-04-24   99  
1e57b82891ade3 Charles Keepax     2018-04-24  100  	ret = soc_compr_components_open(cstream, &component);
1e57b82891ade3 Charles Keepax     2018-04-24  101  	if (ret < 0)
1e57b82891ade3 Charles Keepax     2018-04-24  102  		goto machine_err;
9e7e3738ab0e90 Kuninori Morimoto  2017-10-11  103  
1245b7005de02d Namarta Kohli      2012-08-16  104  	if (rtd->dai_link->compr_ops && rtd->dai_link->compr_ops->startup) {
1245b7005de02d Namarta Kohli      2012-08-16  105  		ret = rtd->dai_link->compr_ops->startup(cstream);
1245b7005de02d Namarta Kohli      2012-08-16  106  		if (ret < 0) {
141dfc9e3751f5 Charles Keepax     2018-01-26  107  			dev_err(rtd->dev,
141dfc9e3751f5 Charles Keepax     2018-01-26  108  				"Compress ASoC: %s startup failed: %d\n",
141dfc9e3751f5 Charles Keepax     2018-01-26  109  				rtd->dai_link->name, ret);
1245b7005de02d Namarta Kohli      2012-08-16  110  			goto machine_err;
1245b7005de02d Namarta Kohli      2012-08-16  111  		}
1245b7005de02d Namarta Kohli      2012-08-16  112  	}
1245b7005de02d Namarta Kohli      2012-08-16  113  
24894b76468ed2 Lars-Peter Clausen 2014-03-05  114  	snd_soc_runtime_activate(rtd, cstream->direction);
1245b7005de02d Namarta Kohli      2012-08-16  115  
72b745e3ad65de Peter Ujfalusi     2019-08-13  116  	mutex_unlock(&rtd->card->pcm_mutex);
15e2e6194a3ae1 Charles Keepax     2013-01-24  117  
1245b7005de02d Namarta Kohli      2012-08-16  118  	return 0;
1245b7005de02d Namarta Kohli      2012-08-16  119  
1245b7005de02d Namarta Kohli      2012-08-16  120  machine_err:
1e57b82891ade3 Charles Keepax     2018-04-24  121  	soc_compr_components_free(cstream, component);
9e7e3738ab0e90 Kuninori Morimoto  2017-10-11  122  
2e622ae41e653c Vinod Koul         2016-11-13  123  	if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown)
2e622ae41e653c Vinod Koul         2016-11-13  124  		cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
1245b7005de02d Namarta Kohli      2012-08-16  125  out:
72b745e3ad65de Peter Ujfalusi     2019-08-13  126  	mutex_unlock(&rtd->card->pcm_mutex);
4137f4b65df760 Cezary Rojewski    2019-12-17  127  pm_err:
613fb50059cf19 Kuninori Morimoto  2020-01-10  128  	for_each_rtd_components(rtd, i, component) {
4137f4b65df760 Cezary Rojewski    2019-12-17  129  		if (component == save)
4137f4b65df760 Cezary Rojewski    2019-12-17  130  			break;
4137f4b65df760 Cezary Rojewski    2019-12-17  131  		pm_runtime_mark_last_busy(component->dev);
4137f4b65df760 Cezary Rojewski    2019-12-17  132  		pm_runtime_put_autosuspend(component->dev);
4137f4b65df760 Cezary Rojewski    2019-12-17  133  	}
4137f4b65df760 Cezary Rojewski    2019-12-17  134  
1245b7005de02d Namarta Kohli      2012-08-16  135  	return ret;
1245b7005de02d Namarta Kohli      2012-08-16  136  }
1245b7005de02d Namarta Kohli      2012-08-16  137  

:::::: The code at line 75 was first introduced by commit
:::::: 4137f4b65df7608e52f307f4aa9792b984bad7de ASoC: compress: Add pm_runtime support

:::::: TO: Cezary Rojewski <[email protected]> :::::: CC: Mark Brown <[email protected]>

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

#1 lore raw

Hi

Quoted 12 lines
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7a56db0299f9d43b4fe076838150c5cc293df131
commit: 613fb50059cf19aa6acbc503a00265d9151c0b09 ASoC: soc-core: remove snd_soc_rtdcom_list
date:   3 months ago
config: i386-randconfig-a002-20200420 (attached as .config)
compiler: gcc-6 (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
reproduce:
        git checkout 613fb50059cf19aa6acbc503a00265d9151c0b09
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag as appropriate

Quoted 8 lines

All warnings (new ones prefixed by >>):

sound/soc/soc-compress.c: In function 'soc_compr_open':

Quoted 1 line
Quoted 1 line

sound/soc/soc-compress.c:75:28: warning: 'component' is used uninitialized in this function [-Wuninitialized]

     struct snd_soc_component *component, *save = NULL;
                               ^~~~~~~~~

Hmm... I still can't reproduce this issue.
I don't have gcc-6, thus can't try it.
Is this the issue ??

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#2 lore raw
Quoted 18 lines · Kuninori Morimoto

Hi

Quoted 16 lines
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7a56db0299f9d43b4fe076838150c5cc293df131
commit: 613fb50059cf19aa6acbc503a00265d9151c0b09 ASoC: soc-core: remove snd_soc_rtdcom_list
date:   3 months ago
config: i386-randconfig-a002-20200420 (attached as .config)
compiler: gcc-6 (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
reproduce:
         git checkout 613fb50059cf19aa6acbc503a00265d9151c0b09
         # save the attached .config to linux build tree
         make ARCH=i386

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

Quoted 7 lines
Quoted 4 lines

sound/soc/soc-compress.c: In function 'soc_compr_open':

Quoted 1 line
Quoted 1 line

sound/soc/soc-compress.c:75:28: warning: 'component' is used uninitialized in this function [-Wuninitialized]

      struct snd_soc_component *component, *save = NULL;
                                ^~~~~~~~~

Hmm... I still can't reproduce this issue.
I don't have gcc-6, thus can't try it.
Is this the issue ??

Hi Kuninori,

We can reproduce the warning with gcc-6 (gcc version 6.5.0 20181026 (Debian 6.5.0-2)),
and the warning can be closed if changed to "struct snd_soc_component *component = NULL, *save = NULL;"

Best Regards,
Rong Chen

#3 lore raw

Hi Rong

Quoted 3 lines
Quoted 3 lines

Hmm... I still can't reproduce this issue.
I don't have gcc-6, thus can't try it.
Is this the issue ??

(snip)

Quoted 4 lines

We can reproduce the warning with gcc-6 (gcc version 6.5.0 20181026 (Debian 6.5.0-2)),
and the warning can be closed if changed to "struct snd_soc_component *component = NULL, *save = NULL;"

Thank you for your feedback.
It sounds reasonable for me.
Can you post it ? or do you want me to do it ?

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#4 lore raw
Quoted 5 lines · Kuninori Morimoto

Hi Rong

Quoted 3 lines
Quoted 3 lines

Hmm... I still can't reproduce this issue.
I don't have gcc-6, thus can't try it.
Is this the issue ??

Quoted 8 lines

(snip)

Quoted 4 lines

We can reproduce the warning with gcc-6 (gcc version 6.5.0 20181026 (Debian 6.5.0-2)),
and the warning can be closed if changed to "struct snd_soc_component *component = NULL, *save = NULL;"

Thank you for your feedback.
It sounds reasonable for me.
Can you post it ? or do you want me to do it ?

Thanks, I have posted it.

Best Regards,
Rong Chen

#5 lore raw

PATCH 1/1 ASoC: soc-compress: avoid false-positive Wuninitialized warning

In reply to kbuild test robot

gcc-6.5 and earlier show a new warning:

sound/soc/soc-compress.c: In function ‘soc_compr_open’:
sound/soc/soc-compress.c:75:28: warning: ‘component’ is used uninitialized in this function [-Wuninitialized]

  struct snd_soc_component *component, *save = NULL;
                              ^~~~~~~~~

Simplest fix is to initialize it to avoid the warning.

---
 sound/soc/soc-compress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-compress.c +1 -1
index 50062eb79adb..e7bd80ed7f2e 100644
@@ -72,7 +72,7 @@ static int soc_compr_components_free(struct snd_compr_stream *cstream,
 static int soc_compr_open(struct snd_compr_stream *cstream)
 {
 	struct snd_soc_pcm_runtime *rtd = cstream->private_data;
-	struct snd_soc_component *component, *save = NULL;
+	struct snd_soc_component *component = NULL, *save = NULL;
 	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
 	int ret, i;
 
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#6 lore raw

Re: [PATCH] ASoC: soc-compress: avoid false-positive Wuninitialized warning

Hi

Quoted 7 lines

gcc-6.5 and earlier show a new warning:

sound/soc/soc-compress.c: In function ‘soc_compr_open’:
sound/soc/soc-compress.c:75:28: warning: ‘component’ is used uninitialized in this function [-Wuninitialized]

  struct snd_soc_component *component, *save = NULL;
                              ^~~~~~~~~
Quoted 7 lines

Simplest fix is to initialize it to avoid the warning.

---

Thank you for your help !!

Best regards
---
Kuninori Morimoto

maintainer
#7 lore raw

Re: [PATCH] ASoC: soc-compress: avoid false-positive Wuninitialized warning

In reply to Rong Chen
Quoted 8 lines · Rong Chen

gcc-6.5 and earlier show a new warning:

sound/soc/soc-compress.c: In function ‘soc_compr_open’:
sound/soc/soc-compress.c:75:28: warning: ‘component’ is used uninitialized in this function [-Wuninitialized]

  struct snd_soc_component *component, *save = NULL;
                              ^~~~~~~~~

Simplest fix is to initialize it to avoid the warning.

This doesn't apply against current code, please check and resend. TBH I'm not 100% sure the benefit here is worth it, this is a very old compiler and it seems like a bug in the compiler.

maintainer
#8 lore raw

Re: [PATCH] ASoC: soc-compress: avoid false-positive Wuninitialized warning

In reply to Rong Chen
Quoted 8 lines · Rong Chen

gcc-6.5 and earlier show a new warning:

sound/soc/soc-compress.c: In function ‘soc_compr_open’:
sound/soc/soc-compress.c:75:28: warning: ‘component’ is used uninitialized in this function [-Wuninitialized]

  struct snd_soc_component *component, *save = NULL;
                              ^~~~~~~~~

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.8

Thanks!

[1/1] ASoC: soc-compress: avoid false-positive Wuninitialized warning

      commit: 3e645a4add53eec22f3818c9da01c19191525096

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

#9 lore raw

PATCH v2 1/1 ASoC: soc-compress: avoid false-positive Wuninitialized warning

In reply to kbuild test robot

gcc-6.5 and earlier show a new warning:

sound/soc/soc-compress.c: In function ‘soc_compr_open’:
sound/soc/soc-compress.c:75:28: warning: ‘component’ is used uninitialized in this function [-Wuninitialized]

  struct snd_soc_component *component, *save = NULL;
                              ^~~~~~~~~

Simplest fix is to initialize it to avoid the warning.

---
 sound/soc/soc-compress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-compress.c +1 -1
index ceaf976db0bb..8431ff72be63 100644
@@ -72,7 +72,7 @@ static int soc_compr_components_free(struct snd_compr_stream *cstream,
 static int soc_compr_open(struct snd_compr_stream *cstream)
 {
 	struct snd_soc_pcm_runtime *rtd = cstream->private_data;
-	struct snd_soc_component *component, *save = NULL;
+	struct snd_soc_component *component = NULL, *save = NULL;
 	struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
 	int ret, i;
 
Signature · 1 line
2.20.1
Acked-by on v2 1/1
#10 lore raw

Re: [PATCH v2] ASoC: soc-compress: avoid false-positive Wuninitialized warning

Hi

Quoted 7 lines

gcc-6.5 and earlier show a new warning:

sound/soc/soc-compress.c: In function ‘soc_compr_open’:
sound/soc/soc-compress.c:75:28: warning: ‘component’ is used uninitialized in this function [-Wuninitialized]

  struct snd_soc_component *component, *save = NULL;
                              ^~~~~~~~~
Quoted 7 lines

Simplest fix is to initialize it to avoid the warning.

---

Thank you for your help !!

Best regards
---
Kuninori Morimoto

maintainer
#11 lore raw

Re: [PATCH v2] ASoC: soc-compress: avoid false-positive Wuninitialized warning

In reply to Rong Chen
Quoted 8 lines · Rong Chen

gcc-6.5 and earlier show a new warning:

sound/soc/soc-compress.c: In function ‘soc_compr_open’:
sound/soc/soc-compress.c:75:28: warning: ‘component’ is used uninitialized in this function [-Wuninitialized]

  struct snd_soc_component *component, *save = NULL;
                              ^~~~~~~~~

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.8

Thanks!

[1/1] ASoC: soc-compress: avoid false-positive Wuninitialized warning

      commit: 3e645a4add53eec22f3818c9da01c19191525096

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark