mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
ASoC: ops: Fix return value in snd_soc_limit_volume()
As documented snd_soc_limit_volume() should return 0 on success, however
at some point in time this promise was broken when
snd_soc_clip_to_platform_max() was refactored, refactor it once again
using __free() to automatically free struct snd_ctl_elem_value and
return proper value.
Fixes: 7e10d7242e ("ASoC: ops: dynamically allocate struct snd_ctl_elem_value")
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Link: https://patch.msgid.link/20261014200608.118770-3-amade@asmblr.net
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
7ef99fcfbb
commit
223ec2a93b
|
|
@ -406,7 +406,7 @@ EXPORT_SYMBOL_GPL(snd_soc_put_volsw_sx);
|
|||
static int snd_soc_clip_to_platform_max(struct snd_kcontrol *kctl)
|
||||
{
|
||||
struct soc_mixer_control *mc = (struct soc_mixer_control *)kctl->private_value;
|
||||
struct snd_ctl_elem_value *uctl;
|
||||
struct snd_ctl_elem_value *uctl __free(kfree) = NULL;
|
||||
int ret;
|
||||
|
||||
if (!mc->platform_max)
|
||||
|
|
@ -418,7 +418,7 @@ static int snd_soc_clip_to_platform_max(struct snd_kcontrol *kctl)
|
|||
|
||||
ret = kctl->get(kctl, uctl);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
return ret;
|
||||
|
||||
if (uctl->value.integer.value[0] > mc->platform_max)
|
||||
uctl->value.integer.value[0] = mc->platform_max;
|
||||
|
|
@ -428,10 +428,10 @@ static int snd_soc_clip_to_platform_max(struct snd_kcontrol *kctl)
|
|||
uctl->value.integer.value[1] = mc->platform_max;
|
||||
|
||||
ret = kctl->put(kctl, uctl);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
out:
|
||||
kfree(uctl);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user