From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Colin Ian King <colin.i.king@gmail.com>,
Oder Chiou <oder_chiou@realtek.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] ASoC: rt712-sdca: remove redundant else path of if statement
Date: Wed, 7 May 2025 19:15:18 +0200 [thread overview]
Message-ID: <5ab1af21-ebe4-43a4-bb70-fa25c442e24f@wanadoo.fr> (raw)
In-Reply-To: <20250507140907.255562-1-colin.i.king@gmail.com>
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
next prev parent reply other threads:[~2025-05-07 17:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 14:09 Colin Ian King
2025-05-07 17:15 ` Christophe JAILLET [this message]
2025-05-08 14:39 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5ab1af21-ebe4-43a4-bb70-fa25c442e24f@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=broonie@kernel.org \
--cc=colin.i.king@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=oder_chiou@realtek.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®