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

From: Liu Jing
Date: Tue Oct 15 2024 - 03:08:41 EST


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@xxxxxxxxxxxxxxxxxxxx>
---
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