[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250508084527.316380-1-colin.i.king@gmail.com>
Date: Thu, 8 May 2025 09:45:27 +0100
From: Colin Ian King <colin.i.king@...il.com>
To: Oder Chiou <oder_chiou@...ltek.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
linux-sound@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org,
linux-kernel@...r.kernel.org,
christophe.jaillet@...adoo.fr
Subject: [PATCH][V2][next] ASoC: rt712-sdca: remove redundant else path of if statement
There is an if/else check where the else part is executed if
adc_vol_flag is true, this else path checks if adc_vol_flag
is true (which is a redundant second check) and the if path is
always taken. Remove the redundant check and remove the else
path since that can never occur.
Signed-off-by: Colin Ian King <colin.i.king@...il.com>
---
V1: Fix just for rt712-sdca.c
V2: Fix for both rt712-sdca.c and rt712-sdca-dmic.c
---
sound/soc/codecs/rt712-sdca-dmic.c | 8 ++------
sound/soc/codecs/rt712-sdca.c | 8 ++------
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/sound/soc/codecs/rt712-sdca-dmic.c b/sound/soc/codecs/rt712-sdca-dmic.c
index db011da63bd9..4d044dfa3136 100644
--- a/sound/soc/codecs/rt712-sdca-dmic.c
+++ b/sound/soc/codecs/rt712-sdca-dmic.c
@@ -263,12 +263,8 @@ static int rt712_sdca_dmic_set_gain_get(struct snd_kcontrol *kcontrol,
if (!adc_vol_flag) /* boost gain */
ctl = regvalue / 0x0a00;
- else { /* ADC gain */
- if (adc_vol_flag)
- ctl = p->max - (((0x1e00 - regvalue) & 0xffff) / interval_offset);
- else
- ctl = p->max - (((0 - regvalue) & 0xffff) / interval_offset);
- }
+ else /* ADC gain */
+ ctl = p->max - (((0x1e00 - regvalue) & 0xffff) / interval_offset);
ucontrol->value.integer.value[i] = ctl;
}
diff --git a/sound/soc/codecs/rt712-sdca.c b/sound/soc/codecs/rt712-sdca.c
index 19d99b9d4ab2..570c2af1245d 100644
--- a/sound/soc/codecs/rt712-sdca.c
+++ b/sound/soc/codecs/rt712-sdca.c
@@ -1065,12 +1065,8 @@ static int rt712_sdca_dmic_set_gain_get(struct snd_kcontrol *kcontrol,
if (!adc_vol_flag) /* boost gain */
ctl = regvalue / 0x0a00;
- else { /* ADC gain */
- if (adc_vol_flag)
- ctl = p->max - (((0x1e00 - regvalue) & 0xffff) / interval_offset);
- else
- ctl = p->max - (((0 - regvalue) & 0xffff) / interval_offset);
- }
+ else /* ADC gain */
+ ctl = p->max - (((0x1e00 - regvalue) & 0xffff) / interval_offset);
ucontrol->value.integer.value[i] = ctl;
}
--
2.49.0
Powered by blists - more mailing lists