* [PATCH][next] ASoC: rt712-sdca: remove redundant else path of if statement
@ 2025-05-07 14:09 Colin Ian King
2025-05-07 17:15 ` Christophe JAILLET
2025-05-08 14:39 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2025-05-07 14:09 UTC (permalink / raw)
To: Oder Chiou, Liam Girdwood, Mark Brown, Takashi Iwai, linux-sound
Cc: kernel-janitors, linux-kernel
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@gmail.com>
---
sound/soc/codecs/rt712-sdca.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH][next] ASoC: rt712-sdca: remove redundant else path of if statement
2025-05-07 14:09 [PATCH][next] ASoC: rt712-sdca: remove redundant else path of if statement Colin Ian King
@ 2025-05-07 17:15 ` Christophe JAILLET
2025-05-08 14:39 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2025-05-07 17:15 UTC (permalink / raw)
To: Colin Ian King, Oder Chiou, Liam Girdwood, Mark Brown,
Takashi Iwai, linux-sound
Cc: kernel-janitors, linux-kernel
Le 07/05/2025 à 16:09, Colin Ian King a écrit :
> 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@gmail.com>
> ---
> sound/soc/codecs/rt712-sdca.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> 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;
> }
Hi,
apparently the same pattern is in rt712-sdca-dmic.c.
CJ
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH][next] ASoC: rt712-sdca: remove redundant else path of if statement
2025-05-07 14:09 [PATCH][next] ASoC: rt712-sdca: remove redundant else path of if statement Colin Ian King
2025-05-07 17:15 ` Christophe JAILLET
@ 2025-05-08 14:39 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2025-05-08 14:39 UTC (permalink / raw)
To: Oder Chiou, Liam Girdwood, Takashi Iwai, linux-sound, Colin Ian King
Cc: kernel-janitors, linux-kernel
On Wed, 07 May 2025 15:09:07 +0100, Colin Ian King wrote:
> 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.
>
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: rt712-sdca: remove redundant else path of if statement
commit: 8147e75bd5f0977f6d389f6cdb4f10956cc3d88f
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-08 14:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-07 14:09 [PATCH][next] ASoC: rt712-sdca: remove redundant else path of if statement Colin Ian King
2025-05-07 17:15 ` Christophe JAILLET
2025-05-08 14:39 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®