summaryrefslogtreecommitdiff
path: root/drivers/firmware/cirrus
diff options
context:
space:
mode:
authorVlad Karpovich <vkarpovi@opensource.cirrus.com>2023-08-15 20:29:08 +0300
committerMark Brown <broonie@kernel.org>2023-08-15 21:23:01 +0300
commit7ac1102b227b36550452b663fd39ab1c09378a95 (patch)
tree65225d036962a2608e3ad962e717a601b3305948 /drivers/firmware/cirrus
parent49a4a8d1261230378a8931d0859329057686b6eb (diff)
downloadlinux-7ac1102b227b36550452b663fd39ab1c09378a95.tar.xz
firmware: cs_dsp: Fix new control name check
Before adding a new FW control, its name is checked against existing controls list. But the string length in strncmp used to compare controls names is taken from the list, so if beginnings of the controls are matching, then the new control is not created. For example, if CAL_R control already exists, CAL_R_SELECTED is not created. The fix is to compare string lengths as well. Fixes: 6477960755fb ("ASoC: wm_adsp: Move check for control existence") Signed-off-by: Vlad Karpovich <vkarpovi@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230815172908.3454056-1-vkarpovi@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/firmware/cirrus')
-rw-r--r--drivers/firmware/cirrus/cs_dsp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
index 6a9aa97373d3..49b70c70dc69 100644
--- a/drivers/firmware/cirrus/cs_dsp.c
+++ b/drivers/firmware/cirrus/cs_dsp.c
@@ -978,7 +978,8 @@ static int cs_dsp_create_control(struct cs_dsp *dsp,
ctl->alg_region.alg == alg_region->alg &&
ctl->alg_region.type == alg_region->type) {
if ((!subname && !ctl->subname) ||
- (subname && !strncmp(ctl->subname, subname, ctl->subname_len))) {
+ (subname && (ctl->subname_len == subname_len) &&
+ !strncmp(ctl->subname, subname, ctl->subname_len))) {
if (!ctl->enabled)
ctl->enabled = 1;
return 0;