[alsa-devel] [PATCH 3/3] asoc: (cosmetic) simplify a function

Guennadi Liakhovetski guennadi.liakhovetski at intel.com
Wed Jan 30 17:22:41 CET 2019


From: Guennadi Liakhovetski <guennadi.liakhovetski at linux.intel.com>

Doing "if (a >= b) return 1; return 0;" can be trivially simplified to
"return a >= b;" Use this for soc_tplg_is_eof().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski at linux.intel.com>
---
 sound/soc/soc-topology.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 045ef136903d..041e7c680a6b 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -111,11 +111,7 @@ static int soc_tplg_check_elem_count(struct soc_tplg *tplg, size_t elem_size,
 
 static inline int soc_tplg_is_eof(struct soc_tplg *tplg)
 {
-	const u8 *end = tplg->hdr_pos;
-
-	if (end >= tplg->fw->data + tplg->fw->size)
-		return 1;
-	return 0;
+	return tplg->hdr_pos >= tplg->fw->data + tplg->fw->size;
 }
 
 static inline unsigned long soc_tplg_get_hdr_offset(struct soc_tplg *tplg)
-- 
2.17.1



More information about the Alsa-devel mailing list