[Sound-open-firmware] [PATCH] volume: fix error in logical operations

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Fri Mar 9 00:20:08 CET 2018


Detected with sonarcloud: test evaluates as always true.
Make sure both volume and switch are handled correctly

Fixes: 43e86cab608 ('volume: fix logic for volume mute/unmute')
Cc: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
---
 src/audio/volume.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/audio/volume.c b/src/audio/volume.c
index ee9b361..45a343e 100644
--- a/src/audio/volume.c
+++ b/src/audio/volume.c
@@ -525,7 +525,8 @@ static int volume_ctrl_get_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *c
 		return -EINVAL;
 	}
 
-	if (cdata->cmd == SOF_CTRL_CMD_VOLUME || SOF_CTRL_CMD_SWITCH) {
+	if (cdata->cmd == SOF_CTRL_CMD_VOLUME ||
+	    cdata->cmd ==  SOF_CTRL_CMD_SWITCH) {
 		trace_volume("vgt");
 		trace_value(cdata->comp_id);
 		for (j = 0; j < cdata->num_elems; j++) {
-- 
2.14.1



More information about the Sound-open-firmware mailing list