[Sound-open-firmware] [PATCH 05/10] tone: replace switch by if for readability

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Mon Sep 25 21:52:13 CEST 2017


MISRA C:2012, 16.5: Every switch statement shall have at least two
switch-clauses

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
---
 src/audio/tone.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/audio/tone.c b/src/audio/tone.c
index 51ceece..0a91f09 100644
--- a/src/audio/tone.c
+++ b/src/audio/tone.c
@@ -484,12 +484,8 @@ static int tone_cmd(struct comp_dev *dev, int cmd, void *data)
 	if (ret < 0)
 		return ret;
 
-	switch (cmd) {
-	case COMP_CMD_SET_VALUE:
-		return tone_ctrl_cmd(dev, cdata);
-	default:
-		break;
-	}
+	if (cmd == COMP_CMD_SET_VALUE)
+		ret = tone_ctrl_cmd(dev, cdata);
 
 	return ret;
 }
-- 
2.11.0



More information about the Sound-open-firmware mailing list