summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2024-02-19 18:44:13 +0100
committerMax Krummenacher <max.krummenacher@toradex.com>2024-02-19 18:44:13 +0100
commit711c394d90cf2e055e8fa90a8559fb29ca07233f (patch)
treefc9f2edad153e9f6713aec2381cc84e1637f982e
parent80c8662762f98e2f55374dff45698e002b90372f (diff)
Revert "ASoC: ops: Check for negative values before reading them"
This reverts commit 1c23070f17c5934e31db5c2dda79c681eedea538.
-rw-r--r--sound/soc/soc-ops.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index d867f449d82d..e73360e9de8f 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -316,26 +316,26 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
if (sign_bit)
mask = BIT(sign_bit + 1) - 1;
- if (ucontrol->value.integer.value[0] < 0)
- return -EINVAL;
val = ucontrol->value.integer.value[0];
if (mc->platform_max && ((int)val + min) > mc->platform_max)
return -EINVAL;
if (val > max - min)
return -EINVAL;
+ if (val < 0)
+ return -EINVAL;
val = (val + min) & mask;
if (invert)
val = max - val;
val_mask = mask << shift;
val = val << shift;
if (snd_soc_volsw_is_stereo(mc)) {
- if (ucontrol->value.integer.value[1] < 0)
- return -EINVAL;
val2 = ucontrol->value.integer.value[1];
if (mc->platform_max && ((int)val2 + min) > mc->platform_max)
return -EINVAL;
if (val2 > max - min)
return -EINVAL;
+ if (val2 < 0)
+ return -EINVAL;
val2 = (val2 + min) & mask;
if (invert)
val2 = max - val2;
@@ -430,13 +430,13 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
int ret;
unsigned int val, val_mask;
- if (ucontrol->value.integer.value[0] < 0)
- return -EINVAL;
val = ucontrol->value.integer.value[0];
if (mc->platform_max && val > mc->platform_max)
return -EINVAL;
if (val > max - min)
return -EINVAL;
+ if (val < 0)
+ return -EINVAL;
val_mask = mask << shift;
val = (val + min) & mask;
val = val << shift;