mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt721-sdca: Clean logically deadcode in rt721-sdca.c
@ 2024-10-08 17:41 Everest K.C.
  2024-10-08 22:56 ` Shuah Khan
  0 siblings, 1 reply; 2+ messages in thread
From: Everest K.C. @ 2024-10-08 17:41 UTC (permalink / raw)
  To: oder_chiou, lgirdwood, broonie, perex, tiwai
  Cc: Everest K.C., skhan, linux-sound, linux-kernel

As the same condition was checked in inner and outer if
statements. The code never reaches the inner else statement.

Signed-off-by: Everest K.C. <everestkc@everestkc.com.np>
---
 sound/soc/codecs/rt721-sdca.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/rt721-sdca.c b/sound/soc/codecs/rt721-sdca.c
index 36056cb7a3ca..4fd26e490610 100644
--- a/sound/soc/codecs/rt721-sdca.c
+++ b/sound/soc/codecs/rt721-sdca.c
@@ -611,13 +611,9 @@ static int rt721_sdca_dmic_set_gain_get(struct snd_kcontrol *kcontrol,
 
 		if (!adc_vol_flag) /* boost gain */
 			ctl = regvalue / boost_step;
-		else { /* ADC gain */
-			if (adc_vol_flag)
-				ctl = p->max - (((vol_max - regvalue) & 0xffff) / interval_offset);
-			else
-				ctl = p->max - (((0 - regvalue) & 0xffff) / interval_offset);
-		}
-
+		else /* ADC gain */
+			ctl = p->max - (((vol_max - regvalue) & 0xffff) / interval_offset);
+
 		ucontrol->value.integer.value[i] = ctl;
 	}
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: rt721-sdca: Clean logically deadcode in rt721-sdca.c
  2024-10-08 17:41 [PATCH] ASoC: rt721-sdca: Clean logically deadcode in rt721-sdca.c Everest K.C.
@ 2024-10-08 22:56 ` Shuah Khan
  0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2024-10-08 22:56 UTC (permalink / raw)
  To: Everest K.C., oder_chiou, lgirdwood, broonie, perex, tiwai
  Cc: linux-sound, linux-kernel, Shuah Khan

On 10/8/24 11:41, Everest K.C. wrote:
> As the same condition was checked in inner and outer if
> statements. The code never reaches the inner else statement.
> 

Looks like this file is only on next. Use next in the prefix
[PATCH-next]

How did you find this problem? Include it in the change log.

> Signed-off-by: Everest K.C. <everestkc@everestkc.com.np>
> ---
>   sound/soc/codecs/rt721-sdca.c | 10 +++-------
>   1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/soc/codecs/rt721-sdca.c b/sound/soc/codecs/rt721-sdca.c
> index 36056cb7a3ca..4fd26e490610 100644
> --- a/sound/soc/codecs/rt721-sdca.c
> +++ b/sound/soc/codecs/rt721-sdca.c
> @@ -611,13 +611,9 @@ static int rt721_sdca_dmic_set_gain_get(struct snd_kcontrol *kcontrol,
>   
>   		if (!adc_vol_flag) /* boost gain */
>   			ctl = regvalue / boost_step;
> -		else { /* ADC gain */
> -			if (adc_vol_flag)
> -				ctl = p->max - (((vol_max - regvalue) & 0xffff) / interval_offset);
> -			else
> -				ctl = p->max - (((0 - regvalue) & 0xffff) / interval_offset);
> -		}
> -
> +		else /* ADC gain */
> +			ctl = p->max - (((vol_max - regvalue) & 0xffff) / interval_offset);
> +
>   		ucontrol->value.integer.value[i] = ctl;
>   	}
>   

Looks reasonable to me. I don't see adc_vol_flag changing.
Possible copy error from sound/soc/codecs/rt722-sdca.c

Perhaps rt722-sdca.c came from sound/soc/codecs/rt712-sdca.c
in which the logic seems to be correct.

In any case, I will leave it to sound experts to comment whether this
patch is correct or not.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-08 22:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-08 17:41 [PATCH] ASoC: rt721-sdca: Clean logically deadcode in rt721-sdca.c Everest K.C.
2024-10-08 22:56 ` Shuah Khan

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®