[PATCH] ASoC: fix code redundancy in sound/soc/soc-dapm.c

Liu Jing posted 1 patch 1 month, 1 week ago
sound/soc/soc-dapm.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
[PATCH] ASoC: fix code redundancy in sound/soc/soc-dapm.c
Posted by Liu Jing 1 month, 1 week ago
In the dapm_widget_power_check function, the logic for assigning the value of w->new_power can be simplified
using the conditional operator

Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com>
---
 sound/soc/soc-dapm.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 9330f1a3f758..865940de32c5 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1428,11 +1428,7 @@ static int dapm_widget_power_check(struct snd_soc_dapm_widget *w)
 	if (w->power_checked)
 		return w->new_power;
 
-	if (w->force)
-		w->new_power = 1;
-	else
-		w->new_power = w->power_check(w);
-
+	w->new_power = w->force ? 1 : w->power_check(w);
 	w->power_checked = true;
 
 	return w->new_power;
-- 
2.27.0