All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] ASoC: soc-pcm: cleanup cppcheck warning
@ 2021-07-27  2:05 Kuninori Morimoto
  2021-07-27  2:05 ` [PATCH 1/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb() Kuninori Morimoto
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Kuninori Morimoto @ 2021-07-27  2:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


Hi Mark

Now I'm posting audio-graph-card2 patch-set, but it seems it needs longer
discussion. Thus I want to post more easy patch first, and reduce my
local patches.

These are cppcheck warning cleanup patches for soc-pcm.

Kuninori Morimoto (5):
  ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb()
  ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_components_close()
  ASoC: soc-pcm: cleanup cppcheck warning at soc_get_playback_capture()
  ASoC: soc-pcm: cleanup cppcheck warning at dpcm_be_is_active()
  ASoC: soc-pcm: cleanup cppcheck warning at dpcm_runtime_setup_be_chan()

 sound/soc/soc-pcm.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

-- 
2.25.1





Thank you for your help !!

Best regards
---
Kuninori Morimoto

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

* [PATCH 1/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb()
  2021-07-27  2:05 [PATCH 0/5] ASoC: soc-pcm: cleanup cppcheck warning Kuninori Morimoto
@ 2021-07-27  2:05 ` Kuninori Morimoto
  2021-07-27 13:33   ` Pierre-Louis Bossart
  2021-07-27  2:05 ` [PATCH 2/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_components_close() Kuninori Morimoto
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Kuninori Morimoto @ 2021-07-27  2:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-pcm.c:446:29: style: The scope of the variable 'pcm_codec' can be reduced. [variableScope]
 struct snd_soc_pcm_stream *pcm_codec, *pcm_cpu;
                            ^
sound/soc/soc-pcm.c:446:41: style: The scope of the variable 'pcm_cpu' can be reduced. [variableScope]
 struct snd_soc_pcm_stream *pcm_codec, *pcm_cpu;
                                        ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-pcm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index cd12ce14096d..69c1022885ed 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -449,13 +449,12 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream)
 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
 	struct snd_soc_dai *cpu_dai;
 	struct snd_soc_dai *codec_dai;
-	struct snd_soc_pcm_stream *pcm_codec, *pcm_cpu;
 	int stream = substream->stream;
 	int i;
 	unsigned int bits = 0, cpu_bits = 0;
 
 	for_each_rtd_codec_dais(rtd, i, codec_dai) {
-		pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream);
+		struct snd_soc_pcm_stream *pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream);
 
 		if (pcm_codec->sig_bits == 0) {
 			bits = 0;
@@ -465,7 +464,7 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream)
 	}
 
 	for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
-		pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream);
+		struct snd_soc_pcm_stream *pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream);
 
 		if (pcm_cpu->sig_bits == 0) {
 			cpu_bits = 0;
-- 
2.25.1


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

* [PATCH 2/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_components_close()
  2021-07-27  2:05 [PATCH 0/5] ASoC: soc-pcm: cleanup cppcheck warning Kuninori Morimoto
  2021-07-27  2:05 ` [PATCH 1/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb() Kuninori Morimoto
@ 2021-07-27  2:05 ` Kuninori Morimoto
  2021-07-27  2:05 ` [PATCH 3/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_get_playback_capture() Kuninori Morimoto
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Kuninori Morimoto @ 2021-07-27  2:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-pcm.c:631:9: style: The scope of the variable 'r' can be reduced. [variableScope]
 int i, r, ret = 0;
        ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 69c1022885ed..c59d769ad039 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -633,10 +633,10 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream,
 {
 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
 	struct snd_soc_component *component;
-	int i, r, ret = 0;
+	int i, ret = 0;
 
 	for_each_rtd_components(rtd, i, component) {
-		r = snd_soc_component_close(component, substream, rollback);
+		int r = snd_soc_component_close(component, substream, rollback);
 		if (r < 0)
 			ret = r; /* use last ret */
 
-- 
2.25.1


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

* [PATCH 3/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_get_playback_capture()
  2021-07-27  2:05 [PATCH 0/5] ASoC: soc-pcm: cleanup cppcheck warning Kuninori Morimoto
  2021-07-27  2:05 ` [PATCH 1/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb() Kuninori Morimoto
  2021-07-27  2:05 ` [PATCH 2/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_components_close() Kuninori Morimoto
@ 2021-07-27  2:05 ` Kuninori Morimoto
  2021-07-27  2:05 ` [PATCH 4/5] ASoC: soc-pcm: cleanup cppcheck warning at dpcm_be_is_active() Kuninori Morimoto
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Kuninori Morimoto @ 2021-07-27  2:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-pcm.c:2578:22: style: The scope of the variable 'codec_dai' can be reduced. [variableScope]
 struct snd_soc_dai *codec_dai;
                     ^
sound/soc/soc-pcm.c:2580:6: style: The scope of the variable 'stream' can be reduced. [variableScope]
 int stream;
     ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-pcm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index c59d769ad039..33ddadafe3de 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2580,9 +2580,7 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
 static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd,
 				    int *playback, int *capture)
 {
-	struct snd_soc_dai *codec_dai;
 	struct snd_soc_dai *cpu_dai;
-	int stream;
 	int i;
 
 	if (rtd->dai_link->dynamic && rtd->num_cpus > 1) {
@@ -2592,6 +2590,8 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd,
 	}
 
 	if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) {
+		int stream;
+
 		if (rtd->dai_link->dpcm_playback) {
 			stream = SNDRV_PCM_STREAM_PLAYBACK;
 
@@ -2626,6 +2626,8 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd,
 			}
 		}
 	} else {
+		struct snd_soc_dai *codec_dai;
+
 		/* Adapt stream for codec2codec links */
 		int cpu_capture = rtd->dai_link->params ?
 			SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
-- 
2.25.1


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

* [PATCH 4/5] ASoC: soc-pcm: cleanup cppcheck warning at dpcm_be_is_active()
  2021-07-27  2:05 [PATCH 0/5] ASoC: soc-pcm: cleanup cppcheck warning Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2021-07-27  2:05 ` [PATCH 3/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_get_playback_capture() Kuninori Morimoto
@ 2021-07-27  2:05 ` Kuninori Morimoto
  2021-07-27  2:05 ` [PATCH 5/5] ASoC: soc-pcm: cleanup cppcheck warning at dpcm_runtime_setup_be_chan() Kuninori Morimoto
  2021-07-27 15:46 ` [PATCH 0/5] ASoC: soc-pcm: cleanup cppcheck warning Mark Brown
  5 siblings, 0 replies; 9+ messages in thread
From: Kuninori Morimoto @ 2021-07-27  2:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-pcm.c:1305:30: style: The scope of the variable 'widget' can be reduced. [variableScope]
 struct snd_soc_dapm_widget *widget;
                             ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-pcm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 33ddadafe3de..212660a5f583 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1307,13 +1307,12 @@ void dpcm_path_put(struct snd_soc_dapm_widget_list **list)
 static bool dpcm_be_is_active(struct snd_soc_dpcm *dpcm, int stream,
 			      struct snd_soc_dapm_widget_list *list)
 {
-	struct snd_soc_dapm_widget *widget;
 	struct snd_soc_dai *dai;
 	unsigned int i;
 
 	/* is there a valid DAI widget for this BE */
 	for_each_rtd_dais(dpcm->be, i, dai) {
-		widget = snd_soc_dai_get_widget(dai, stream);
+		struct snd_soc_dapm_widget *widget = snd_soc_dai_get_widget(dai, stream);
 
 		/*
 		 * The BE is pruned only if none of the dai
-- 
2.25.1


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

* [PATCH 5/5] ASoC: soc-pcm: cleanup cppcheck warning at dpcm_runtime_setup_be_chan()
  2021-07-27  2:05 [PATCH 0/5] ASoC: soc-pcm: cleanup cppcheck warning Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2021-07-27  2:05 ` [PATCH 4/5] ASoC: soc-pcm: cleanup cppcheck warning at dpcm_be_is_active() Kuninori Morimoto
@ 2021-07-27  2:05 ` Kuninori Morimoto
  2021-07-27 15:46 ` [PATCH 0/5] ASoC: soc-pcm: cleanup cppcheck warning Mark Brown
  5 siblings, 0 replies; 9+ messages in thread
From: Kuninori Morimoto @ 2021-07-27  2:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-pcm.c:1624:30: style: The scope of the variable 'codec_stream' can be reduced. [variableScope]
  struct snd_soc_pcm_stream *codec_stream;
                             ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 212660a5f583..1e4423f62010 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1625,7 +1625,6 @@ static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream)
 
 	for_each_dpcm_be(fe, stream, dpcm) {
 		struct snd_soc_pcm_runtime *be = dpcm->be;
-		struct snd_soc_pcm_stream *codec_stream;
 		struct snd_soc_pcm_stream *cpu_stream;
 		struct snd_soc_dai *dai;
 		int i;
@@ -1648,7 +1647,8 @@ static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream)
 		 * DAIs connected to a single CPU DAI, use CPU DAI's directly
 		 */
 		if (be->num_codecs == 1) {
-			codec_stream = snd_soc_dai_get_pcm_stream(asoc_rtd_to_codec(be, 0), stream);
+			struct snd_soc_pcm_stream *codec_stream = snd_soc_dai_get_pcm_stream(
+				asoc_rtd_to_codec(be, 0), stream);
 
 			soc_pcm_hw_update_chan(hw, codec_stream);
 		}
-- 
2.25.1


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

* Re: [PATCH 1/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb()
  2021-07-27  2:05 ` [PATCH 1/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb() Kuninori Morimoto
@ 2021-07-27 13:33   ` Pierre-Louis Bossart
  2021-07-27 22:52     ` Kuninori Morimoto
  0 siblings, 1 reply; 9+ messages in thread
From: Pierre-Louis Bossart @ 2021-07-27 13:33 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: Linux-ALSA



On 7/26/21 9:05 PM, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> This patch cleanups below cppcheck warning.
> 
> sound/soc/soc-pcm.c:446:29: style: The scope of the variable 'pcm_codec' can be reduced. [variableScope]
>  struct snd_soc_pcm_stream *pcm_codec, *pcm_cpu;
>                             ^
> sound/soc/soc-pcm.c:446:41: style: The scope of the variable 'pcm_cpu' can be reduced. [variableScope]
>  struct snd_soc_pcm_stream *pcm_codec, *pcm_cpu;
>                                         ^

I personally ignore those warnings, there are hundreds of them and it'd
be a relatively marginal improvement in code quality.

my scripts use the following options to focus on more important issues
first.

--suppress=variableScope --suppress=shiftTooManyBitsSigned
--suppress=arithOperationsOnVoidPointer --suppress=bitwiseOnBoolean


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

* Re: [PATCH 0/5] ASoC: soc-pcm: cleanup cppcheck warning
  2021-07-27  2:05 [PATCH 0/5] ASoC: soc-pcm: cleanup cppcheck warning Kuninori Morimoto
                   ` (4 preceding siblings ...)
  2021-07-27  2:05 ` [PATCH 5/5] ASoC: soc-pcm: cleanup cppcheck warning at dpcm_runtime_setup_be_chan() Kuninori Morimoto
@ 2021-07-27 15:46 ` Mark Brown
  5 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2021-07-27 15:46 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Mark Brown

On 27 Jul 2021 11:05:16 +0900, Kuninori Morimoto wrote:
> Now I'm posting audio-graph-card2 patch-set, but it seems it needs longer
> discussion. Thus I want to post more easy patch first, and reduce my
> local patches.
> 
> These are cppcheck warning cleanup patches for soc-pcm.
> 
> Kuninori Morimoto (5):
>   ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb()
>   ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_components_close()
>   ASoC: soc-pcm: cleanup cppcheck warning at soc_get_playback_capture()
>   ASoC: soc-pcm: cleanup cppcheck warning at dpcm_be_is_active()
>   ASoC: soc-pcm: cleanup cppcheck warning at dpcm_runtime_setup_be_chan()
> 
> [...]

Applied to

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

Thanks!

[1/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb()
      commit: 2bc3e1f21b06802e70d9ccd5f8756099ffd04eb2
[2/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_components_close()
      commit: 33be10b563dc56c33d28562ff83065a89647e443
[3/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_get_playback_capture()
      commit: 940a1f43572316ba3320fea361db2a5200e2de0e
[4/5] ASoC: soc-pcm: cleanup cppcheck warning at dpcm_be_is_active()
      commit: 7931df9bf07bfe62831e559e5ffdca6f3657d92c
[5/5] ASoC: soc-pcm: cleanup cppcheck warning at dpcm_runtime_setup_be_chan()
      commit: 9bdc573d84d8fcfe50b223350598efe4fe1cad08

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

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

* Re: [PATCH 1/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb()
  2021-07-27 13:33   ` Pierre-Louis Bossart
@ 2021-07-27 22:52     ` Kuninori Morimoto
  0 siblings, 0 replies; 9+ messages in thread
From: Kuninori Morimoto @ 2021-07-27 22:52 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: Linux-ALSA, Mark Brown


Hi Pierre-Louis

Thank you for your feedback

> > sound/soc/soc-pcm.c:446:29: style: The scope of the variable 'pcm_codec' can be reduced. [variableScope]
> >  struct snd_soc_pcm_stream *pcm_codec, *pcm_cpu;
> >                             ^
> > sound/soc/soc-pcm.c:446:41: style: The scope of the variable 'pcm_cpu' can be reduced. [variableScope]
> >  struct snd_soc_pcm_stream *pcm_codec, *pcm_cpu;
> >                                         ^
> 
> I personally ignore those warnings, there are hundreds of them and it'd
> be a relatively marginal improvement in code quality.
> 
> my scripts use the following options to focus on more important issues
> first.

Yes, these are not important and boring patch :)
But it will be indicated forever if no one fix it.
I can squash all soc-xxx.c related patches into 1 patch,
but it is not good for backporting (?)

Thank you for your help !!

Best regards
---
Kuninori Morimoto

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

end of thread, other threads:[~2021-07-27 22:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27  2:05 [PATCH 0/5] ASoC: soc-pcm: cleanup cppcheck warning Kuninori Morimoto
2021-07-27  2:05 ` [PATCH 1/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb() Kuninori Morimoto
2021-07-27 13:33   ` Pierre-Louis Bossart
2021-07-27 22:52     ` Kuninori Morimoto
2021-07-27  2:05 ` [PATCH 2/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_components_close() Kuninori Morimoto
2021-07-27  2:05 ` [PATCH 3/5] ASoC: soc-pcm: cleanup cppcheck warning at soc_get_playback_capture() Kuninori Morimoto
2021-07-27  2:05 ` [PATCH 4/5] ASoC: soc-pcm: cleanup cppcheck warning at dpcm_be_is_active() Kuninori Morimoto
2021-07-27  2:05 ` [PATCH 5/5] ASoC: soc-pcm: cleanup cppcheck warning at dpcm_runtime_setup_be_chan() Kuninori Morimoto
2021-07-27 15:46 ` [PATCH 0/5] ASoC: soc-pcm: cleanup cppcheck warning Mark Brown

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.