Jiri Slaby 1fbe11
From: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Jiri Slaby 1fbe11
Date: Mon, 13 Feb 2023 14:50:06 +0000
Jiri Slaby 1fbe11
Subject: [PATCH] ALSA: hda: cs35l41: Correct error condition handling
Jiri Slaby 1fbe11
References: bsc#1012628
Jiri Slaby 1fbe11
Patch-mainline: 6.2.2
Jiri Slaby 1fbe11
Git-commit: 943f4e64ee177cf44d7f2c235281fcda7c32bb28
Jiri Slaby 1fbe11
Jiri Slaby 1fbe11
commit 943f4e64ee177cf44d7f2c235281fcda7c32bb28 upstream.
Jiri Slaby 1fbe11
Jiri Slaby 1fbe11
Function cs_dsp_coeff_write_ctrl() can return 3 possible values:
Jiri Slaby 1fbe11
0 - no change, 1 - value has changed and -1 - error, so positive value
Jiri Slaby 1fbe11
is not an error.
Jiri Slaby 1fbe11
Fixes: 7406bdbc4fb8 ("ASoC: wm_adsp: Return whether changed when writing controls")
Jiri Slaby 1fbe11
Jiri Slaby 1fbe11
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Jiri Slaby 1fbe11
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Jiri Slaby 1fbe11
Link: https://lore.kernel.org/r/20230213145008.1215849-2-sbinding@opensource.cirrus.com
Jiri Slaby 1fbe11
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jiri Slaby 1fbe11
Cc: Richard Fitzgerald <rf@opensource.cirrus.com>
Jiri Slaby 1fbe11
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiri Slaby 1fbe11
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Jiri Slaby 1fbe11
---
Jiri Slaby 1fbe11
 sound/pci/hda/hda_cs_dsp_ctl.c | 4 ++--
Jiri Slaby 1fbe11
 1 file changed, 2 insertions(+), 2 deletions(-)
Jiri Slaby 1fbe11
Jiri Slaby 1fbe11
diff --git a/sound/pci/hda/hda_cs_dsp_ctl.c b/sound/pci/hda/hda_cs_dsp_ctl.c
Jiri Slaby 1fbe11
index 5433f622..463ca060 100644
Jiri Slaby 1fbe11
--- a/sound/pci/hda/hda_cs_dsp_ctl.c
Jiri Slaby 1fbe11
+++ b/sound/pci/hda/hda_cs_dsp_ctl.c
Jiri Slaby 1fbe11
@@ -218,10 +218,10 @@ int hda_cs_dsp_write_ctl(struct cs_dsp *dsp, const char *name, int type,
Jiri Slaby 1fbe11
 	cs_ctl = cs_dsp_get_ctl(dsp, name, type, alg);
Jiri Slaby 1fbe11
 	ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, buf, len);
Jiri Slaby 1fbe11
 	mutex_unlock(&dsp->pwr_lock);
Jiri Slaby 1fbe11
-	if (ret)
Jiri Slaby 1fbe11
+	if (ret < 0)
Jiri Slaby 1fbe11
 		return ret;
Jiri Slaby 1fbe11
 
Jiri Slaby 1fbe11
-	if (cs_ctl->flags & WMFW_CTL_FLAG_SYS)
Jiri Slaby 1fbe11
+	if (ret == 0 || (cs_ctl->flags & WMFW_CTL_FLAG_SYS))
Jiri Slaby 1fbe11
 		return 0;
Jiri Slaby 1fbe11
 
Jiri Slaby 1fbe11
 	ctl = cs_ctl->priv;
Jiri Slaby 1fbe11
-- 
Jiri Slaby 1fbe11
2.35.3
Jiri Slaby 1fbe11