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

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Mon Sep 25 21:52:15 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/drivers/ssp.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/drivers/ssp.c b/src/drivers/ssp.c
index 885a78e..c12c7f1 100644
--- a/src/drivers/ssp.c
+++ b/src/drivers/ssp.c
@@ -244,13 +244,11 @@ static inline int ssp_set_config(struct dai *dai,
 	ssp_write(dai, SSRSA, config->rx_slot_mask);
 
 	/* sample data size on SSP FIFO */
-	switch (config->sample_valid_bits) {
-	case 16:	/* 2 * 16bit packed into 32bit FIFO */
+	if (config->sample_valid_bits == 16)
+		/* 2 * 16bit packed into 32bit FIFO */
 		data_size = 32;
-		break;
-	default:
+	else
 		data_size = config->sample_container_bits;
-	}
 
 	if (data_size > 16)
 		sscr0 |= (SSCR0_EDSS | SSCR0_DSIZE(data_size - 16));
-- 
2.11.0



More information about the Sound-open-firmware mailing list