[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241015031742.5144-1-liujing@cmss.chinamobile.com>
Date: Tue, 15 Oct 2024 11:17:42 +0800
From: Liu Jing <liujing@...s.chinamobile.com>
To: lgirdwood@...il.com
Cc: broonie@...nel.org,
perex@...ex.cz,
tiwai@...e.com,
linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org,
Liu Jing <liujing@...s.chinamobile.com>
Subject: [PATCH] ASoC: fix code redundancy in sound/soc/soc-core.c
In the snd_soc_register_dai function, the logic for assigning the value of dai->id can be simplified
using the conditional operator (also known as the ternary operator).
Signed-off-by: Liu Jing <liujing@...s.chinamobile.com>
---
sound/soc/soc-core.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 20248a29d167..cbe2be64e1c3 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2663,10 +2663,7 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component,
dai->name = fmt_single_name(dev, &dai->id);
} else {
dai->name = fmt_multiple_name(dev, dai_drv);
- if (dai_drv->id)
- dai->id = dai_drv->id;
- else
- dai->id = component->num_dai;
+ dai->id = dai_drv->id ? dai_drv->id : component->num_dai;
}
if (!dai->name)
return NULL;
--
2.27.0
Powered by blists - more mailing lists