All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] ASoC: soc-ops: cleanup cppcheck warning
@ 2021-08-03  5:00 Kuninori Morimoto
  2021-08-03  5:00 ` [PATCH 1/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_volsw_sx() Kuninori Morimoto
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2021-08-03  5:00 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-ops.

Kuninori Morimoto (4):
  ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_volsw_sx()
  ASoC: soc-ops: cleanup cppcheck warning at snd_soc_limit_volume()
  ASoC: soc-ops: cleanup cppcheck warning at snd_soc_get_xr_sx()
  ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_xr_sx()

 sound/soc/soc-ops.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

-- 
2.25.1


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

* [PATCH 1/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_volsw_sx()
  2021-08-03  5:00 [PATCH 0/4] ASoC: soc-ops: cleanup cppcheck warning Kuninori Morimoto
@ 2021-08-03  5:00 ` Kuninori Morimoto
  2021-08-03  5:00 ` [PATCH 2/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_limit_volume() Kuninori Morimoto
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2021-08-03  5:00 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-ops.c:410:30: style: The scope of the variable 'val2' can be reduced. [variableScope]
 unsigned int val, val_mask, val2 = 0;
                             ^

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

diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index 58527247df83..9742e3c345b6 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -407,7 +407,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
 	int min = mc->min;
 	unsigned int mask = (1U << (fls(min + max) - 1)) - 1;
 	int err = 0;
-	unsigned int val, val_mask, val2;
+	unsigned int val, val_mask;
 
 	val_mask = mask << shift;
 	val = (ucontrol->value.integer.value[0] + min) & mask;
@@ -418,6 +418,8 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
 		return err;
 
 	if (snd_soc_volsw_is_stereo(mc)) {
+		unsigned int val2;
+
 		val_mask = mask << rshift;
 		val2 = (ucontrol->value.integer.value[1] + min) & mask;
 		val2 = val2 << rshift;
-- 
2.25.1


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

* [PATCH 2/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_limit_volume()
  2021-08-03  5:00 [PATCH 0/4] ASoC: soc-ops: cleanup cppcheck warning Kuninori Morimoto
  2021-08-03  5:00 ` [PATCH 1/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_volsw_sx() Kuninori Morimoto
@ 2021-08-03  5:00 ` Kuninori Morimoto
  2021-08-03  5:00 ` [PATCH 3/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_get_xr_sx() Kuninori Morimoto
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2021-08-03  5:00 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-ops.c:576:28: style: The scope of the variable 'mc' can be reduced. [variableScope]
 struct soc_mixer_control *mc;
                           ^

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

diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index 9742e3c345b6..11be75f25300 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -575,7 +575,6 @@ int snd_soc_limit_volume(struct snd_soc_card *card,
 	const char *name, int max)
 {
 	struct snd_kcontrol *kctl;
-	struct soc_mixer_control *mc;
 	int ret = -EINVAL;
 
 	/* Sanity check for name and max */
@@ -584,7 +583,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card,
 
 	kctl = snd_soc_card_get_kcontrol(card, name);
 	if (kctl) {
-		mc = (struct soc_mixer_control *)kctl->private_value;
+		struct soc_mixer_control *mc = (struct soc_mixer_control *)kctl->private_value;
 		if (max <= mc->max) {
 			mc->platform_max = max;
 			ret = 0;
-- 
2.25.1


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

* [PATCH 3/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_get_xr_sx()
  2021-08-03  5:00 [PATCH 0/4] ASoC: soc-ops: cleanup cppcheck warning Kuninori Morimoto
  2021-08-03  5:00 ` [PATCH 1/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_volsw_sx() Kuninori Morimoto
  2021-08-03  5:00 ` [PATCH 2/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_limit_volume() Kuninori Morimoto
@ 2021-08-03  5:00 ` Kuninori Morimoto
  2021-08-03  5:01 ` [PATCH 4/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_xr_sx() Kuninori Morimoto
  2021-08-03 22:35 ` [PATCH 0/4] ASoC: soc-ops: cleanup cppcheck warning Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2021-08-03  5:00 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-ops.c:814:15: style: The scope of the variable 'regval' can be reduced. [variableScope]
 unsigned int regval;
              ^

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

diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index 11be75f25300..93bb8bc5ae33 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -812,11 +812,10 @@ int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol,
 	long min = mc->min;
 	long max = mc->max;
 	long val = 0;
-	unsigned int regval;
 	unsigned int i;
 
 	for (i = 0; i < regcount; i++) {
-		regval = snd_soc_component_read(component, regbase+i);
+		unsigned int regval = snd_soc_component_read(component, regbase+i);
 		val |= (regval & regwmask) << (regwshift*(regcount-i-1));
 	}
 	val &= mask;
-- 
2.25.1


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

* [PATCH 4/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_xr_sx()
  2021-08-03  5:00 [PATCH 0/4] ASoC: soc-ops: cleanup cppcheck warning Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2021-08-03  5:00 ` [PATCH 3/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_get_xr_sx() Kuninori Morimoto
@ 2021-08-03  5:01 ` Kuninori Morimoto
  2021-08-03 22:35 ` [PATCH 0/4] ASoC: soc-ops: cleanup cppcheck warning Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2021-08-03  5:01 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-ops.c:859:18: style: The scope of the variable 'regval' can be reduced. [variableScope]
 unsigned int i, regval, regmask;
                 ^
sound/soc/soc-ops.c:859:26: style: The scope of the variable 'regmask' can be reduced. [variableScope]
 unsigned int i, regval, regmask;
                         ^
sound/soc/soc-ops.c:860:6: style: The scope of the variable 'err' can be reduced. [variableScope]
 int err;
     ^

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

diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index 93bb8bc5ae33..08eaa9ddf191 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -856,17 +856,16 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
 	unsigned long mask = (1UL<<mc->nbits)-1;
 	long max = mc->max;
 	long val = ucontrol->value.integer.value[0];
-	unsigned int i, regval, regmask;
-	int err;
+	unsigned int i;
 
 	if (invert)
 		val = max - val;
 	val &= mask;
 	for (i = 0; i < regcount; i++) {
-		regval = (val >> (regwshift*(regcount-i-1))) & regwmask;
-		regmask = (mask >> (regwshift*(regcount-i-1))) & regwmask;
-		err = snd_soc_component_update_bits(component, regbase+i,
-				regmask, regval);
+		unsigned int regval = (val >> (regwshift*(regcount-i-1))) & regwmask;
+		unsigned int regmask = (mask >> (regwshift*(regcount-i-1))) & regwmask;
+		int err = snd_soc_component_update_bits(component, regbase+i,
+							regmask, regval);
 		if (err < 0)
 			return err;
 	}
-- 
2.25.1


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

* Re: [PATCH 0/4] ASoC: soc-ops: cleanup cppcheck warning
  2021-08-03  5:00 [PATCH 0/4] ASoC: soc-ops: cleanup cppcheck warning Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2021-08-03  5:01 ` [PATCH 4/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_xr_sx() Kuninori Morimoto
@ 2021-08-03 22:35 ` Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2021-08-03 22:35 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Mark Brown

On 03 Aug 2021 14:00:12 +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-ops.
> 
> Kuninori Morimoto (4):
>   ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_volsw_sx()
>   ASoC: soc-ops: cleanup cppcheck warning at snd_soc_limit_volume()
>   ASoC: soc-ops: cleanup cppcheck warning at snd_soc_get_xr_sx()
>   ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_xr_sx()
> 
> [...]

Applied to

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

Thanks!

[1/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_volsw_sx()
      commit: 58f42dfd7977599b060996491412fcec688d025d
[2/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_limit_volume()
      commit: 872040f7980b929d75877e7b9d721ea808ce06e1
[3/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_get_xr_sx()
      commit: b1ebecb90bf69fbd288e873bbf545061f5a6c144
[4/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_xr_sx()
      commit: b285b51018a7ca206401829fb83c8b967c22bfa5

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] 6+ messages in thread

end of thread, other threads:[~2021-08-03 22:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03  5:00 [PATCH 0/4] ASoC: soc-ops: cleanup cppcheck warning Kuninori Morimoto
2021-08-03  5:00 ` [PATCH 1/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_volsw_sx() Kuninori Morimoto
2021-08-03  5:00 ` [PATCH 2/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_limit_volume() Kuninori Morimoto
2021-08-03  5:00 ` [PATCH 3/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_get_xr_sx() Kuninori Morimoto
2021-08-03  5:01 ` [PATCH 4/4] ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_xr_sx() Kuninori Morimoto
2021-08-03 22:35 ` [PATCH 0/4] ASoC: soc-ops: 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.