Commit f3f5798d authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: soc-ops: cleanup cppcheck warning" from Kuninori Morimoto...

Merge series "ASoC: soc-ops: cleanup cppcheck warning" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

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
parents 8ff93924 b285b510
...@@ -407,7 +407,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, ...@@ -407,7 +407,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
int min = mc->min; int min = mc->min;
unsigned int mask = (1U << (fls(min + max) - 1)) - 1; unsigned int mask = (1U << (fls(min + max) - 1)) - 1;
int err = 0; int err = 0;
unsigned int val, val_mask, val2; unsigned int val, val_mask;
val_mask = mask << shift; val_mask = mask << shift;
val = (ucontrol->value.integer.value[0] + min) & mask; val = (ucontrol->value.integer.value[0] + min) & mask;
...@@ -418,6 +418,8 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, ...@@ -418,6 +418,8 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
return err; return err;
if (snd_soc_volsw_is_stereo(mc)) { if (snd_soc_volsw_is_stereo(mc)) {
unsigned int val2;
val_mask = mask << rshift; val_mask = mask << rshift;
val2 = (ucontrol->value.integer.value[1] + min) & mask; val2 = (ucontrol->value.integer.value[1] + min) & mask;
val2 = val2 << rshift; val2 = val2 << rshift;
...@@ -573,7 +575,6 @@ int snd_soc_limit_volume(struct snd_soc_card *card, ...@@ -573,7 +575,6 @@ int snd_soc_limit_volume(struct snd_soc_card *card,
const char *name, int max) const char *name, int max)
{ {
struct snd_kcontrol *kctl; struct snd_kcontrol *kctl;
struct soc_mixer_control *mc;
int ret = -EINVAL; int ret = -EINVAL;
/* Sanity check for name and max */ /* Sanity check for name and max */
...@@ -582,7 +583,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card, ...@@ -582,7 +583,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card,
kctl = snd_soc_card_get_kcontrol(card, name); kctl = snd_soc_card_get_kcontrol(card, name);
if (kctl) { 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) { if (max <= mc->max) {
mc->platform_max = max; mc->platform_max = max;
ret = 0; ret = 0;
...@@ -811,11 +812,10 @@ int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, ...@@ -811,11 +812,10 @@ int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol,
long min = mc->min; long min = mc->min;
long max = mc->max; long max = mc->max;
long val = 0; long val = 0;
unsigned int regval;
unsigned int i; unsigned int i;
for (i = 0; i < regcount; 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 |= (regval & regwmask) << (regwshift*(regcount-i-1));
} }
val &= mask; val &= mask;
...@@ -856,17 +856,16 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol, ...@@ -856,17 +856,16 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
unsigned long mask = (1UL<<mc->nbits)-1; unsigned long mask = (1UL<<mc->nbits)-1;
long max = mc->max; long max = mc->max;
long val = ucontrol->value.integer.value[0]; long val = ucontrol->value.integer.value[0];
unsigned int i, regval, regmask; unsigned int i;
int err;
if (invert) if (invert)
val = max - val; val = max - val;
val &= mask; val &= mask;
for (i = 0; i < regcount; i++) { for (i = 0; i < regcount; i++) {
regval = (val >> (regwshift*(regcount-i-1))) & regwmask; unsigned int regval = (val >> (regwshift*(regcount-i-1))) & regwmask;
regmask = (mask >> (regwshift*(regcount-i-1))) & regwmask; unsigned int regmask = (mask >> (regwshift*(regcount-i-1))) & regwmask;
err = snd_soc_component_update_bits(component, regbase+i, int err = snd_soc_component_update_bits(component, regbase+i,
regmask, regval); regmask, regval);
if (err < 0) if (err < 0)
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment