[01/13] topology: Use snd_config_get_bool to simplify boolean flag parsing
diff mbox

Message ID 9b8b6816e96c655f4b9625be41b36eed91dd2464.1478407716.git.mengdong.lin@linux.intel.com
State New
Headers show

Commit Message

mengdong.lin@linux.intel.com Nov. 6, 2016, 5:11 a.m. UTC
From: Mengdong Lin <mengdong.lin@linux.intel.com>

The link flags in the text conf file are boolean, so this patch uses
snd_config_get_bool() to simplify the code.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>

Patch
diff mbox

diff --git a/src/topology/pcm.c b/src/topology/pcm.c
index 3f54e94..b7a2df7 100644
--- a/src/topology/pcm.c
+++ b/src/topology/pcm.c
@@ -400,13 +400,14 @@  static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
 static int parse_flag(snd_config_t *n, unsigned int mask_in,
 		      unsigned int *mask, unsigned int *flags)
 {
-	const char *val = NULL;
+	int ret;
 
-	if (snd_config_get_string(n, &val) < 0)
-		return -EINVAL;
+	ret = snd_config_get_bool(n);
+	if (ret < 0)
+		return ret;
 
 	*mask |= mask_in;
-	if (strcmp(val, "true") == 0)
+	if (ret)
 		*flags |= mask_in;
 	else
 		*flags &= ~mask_in;