diff options
author | Charles Keepax <ckeepax@opensource.cirrus.com> | 2018-07-19 11:50:36 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-07-19 15:11:54 +0100 |
commit | b7ede5af62ab6bfad0980fad58e82d3fb56866df (patch) | |
tree | bc4f80816f28050efb20f2c896644417aead26ac /sound/soc/codecs/wm_adsp.c | |
parent | 517ee74e1b3124b696f293aa4e220418f8125b4c (diff) | |
download | linux-b7ede5af62ab6bfad0980fad58e82d3fb56866df.tar.bz2 |
ASoC: wm_adsp: Take prefix into account in control name length
Currently when creating ALSA control names for the DSP the length of any
prefix applied to the CODEC is not taken into account. Whilst this is
mostly harmless it does result in ALSA doing the truncation of the
control names and printing a warning. It is better to have the driver do
the truncation so it can truncate from the start of parameter name
itself to give a greater chance of the result maintain a unique name.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/wm_adsp.c')
-rw-r--r-- | sound/soc/codecs/wm_adsp.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 99108d18de8d..eec73c98a141 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -1343,6 +1343,9 @@ static int wm_adsp_create_control(struct wm_adsp *dsp, int avail = SNDRV_CTL_ELEM_ID_NAME_MAXLEN - ret - 2; int skip = 0; + if (dsp->component->name_prefix) + avail -= strlen(dsp->component->name_prefix) + 1; + if (subname_len > avail) skip = subname_len - avail; |