2020-04-20 08:03:28

by kernel test robot

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

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
Reported-by: kbuild test robot <[email protected]>

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/[email protected]


Attachments:
(No filename) (6.42 kB)
.config.gz (35.18 kB)
Download all attachments

2020-04-21 06:27:39

by Kuninori Morimoto

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


Hi

> 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
> Reported-by: kbuild test robot <[email protected]>
>
> 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;
> ^~~~~~~~~

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

2020-04-22 01:22:02

by Chen, Rong A

[permalink] [raw]
Subject: Re: [kbuild-all] Re: sound/soc/soc-compress.c:75:28: warning: 'component' is used uninitialized in this function



On 4/21/20 2:23 PM, Kuninori Morimoto wrote:
> Hi
>
>> 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
>> Reported-by: kbuild test robot <[email protected]>
>>
>> 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;
>> ^~~~~~~~~
> 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

2020-04-22 04:58:44

by Kuninori Morimoto

[permalink] [raw]
Subject: Re: [kbuild-all] Re: sound/soc/soc-compress.c:75:28: warning: 'component' is used uninitialized in this function


Hi Rong

> > Hmm... I still can't reproduce this issue.
> > I don't have gcc-6, thus can't try it.
> > Is this the issue ??
(snip)
> 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

2020-04-22 07:38:14

by Chen, Rong A

[permalink] [raw]
Subject: [PATCH] ASoC: soc-compress: avoid false-positive Wuninitialized warning

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.

Reported-by: kbuild test robot <[email protected]>
Cc: Kuninori Morimoto <[email protected]>
Link: https://lore.kernel.org/lkml/202004201540.vYPhhYMs%[email protected]
Signed-off-by: Rong Chen <[email protected]>
---
sound/soc/soc-compress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 50062eb79adb..e7bd80ed7f2e 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -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;

--
2.20.1

2020-04-22 07:43:27

by Chen, Rong A

[permalink] [raw]
Subject: Re: [kbuild-all] Re: sound/soc/soc-compress.c:75:28: warning: 'component' is used uninitialized in this function



On 4/22/20 12:53 PM, Kuninori Morimoto wrote:
> Hi Rong
>
>>> Hmm... I still can't reproduce this issue.
>>> I don't have gcc-6, thus can't try it.
>>> Is this the issue ??
> (snip)
>> 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

2020-04-22 22:22:03

by Kuninori Morimoto

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


Hi

> 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.
>
> Reported-by: kbuild test robot <[email protected]>
> Cc: Kuninori Morimoto <[email protected]>
> Link: https://lore.kernel.org/lkml/202004201540.vYPhhYMs%[email protected]
> Signed-off-by: Rong Chen <[email protected]>
> ---

Acked-by: Kuninori Morimoto <[email protected]>

Thank you for your help !!

Best regards
---
Kuninori Morimoto

2020-04-23 13:52:10

by Mark Brown

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

On Wed, Apr 22, 2020 at 03:35:43PM +0800, Rong Chen wrote:
> 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.


Attachments:
(No filename) (639.00 B)
signature.asc (499.00 B)
Download all attachments

2020-04-24 00:59:12

by Chen, Rong A

[permalink] [raw]
Subject: [PATCH v2] ASoC: soc-compress: avoid false-positive Wuninitialized warning

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.

Reported-by: kbuild test robot <[email protected]>
Cc: Kuninori Morimoto <[email protected]>
Link: https://lore.kernel.org/lkml/202004201540.vYPhhYMs%[email protected]
Signed-off-by: Rong Chen <[email protected]>
---
sound/soc/soc-compress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index ceaf976db0bb..8431ff72be63 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -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;

--
2.20.1

2020-04-24 04:37:04

by Kuninori Morimoto

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


Hi

> 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.
>
> Reported-by: kbuild test robot <[email protected]>
> Cc: Kuninori Morimoto <[email protected]>
> Link: https://lore.kernel.org/lkml/202004201540.vYPhhYMs%[email protected]
> Signed-off-by: Rong Chen <[email protected]>
> ---

Acked-by: Kuninori Morimoto <[email protected]>

Thank you for your help !!

Best regards
---
Kuninori Morimoto

2020-04-24 12:21:42

by Mark Brown

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

On Wed, 22 Apr 2020 15:35:43 +0800, Rong Chen wrote:
> 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

2020-04-24 12:22:41

by Mark Brown

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

On Fri, 24 Apr 2020 08:54:37 +0800, Rong Chen wrote:
> 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