Skip to contentSkip to conversation

ASoC: rt712-sdca: remove redundant else path of if statement

PATCH In review Colin Ian King 2 participants 4 messages May 8, 2025 – May 9, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---

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(-)
sound/soc/codecs/rt712-sdca-dmic.c +2 -6
index db011da63bd9..4d044dfa3136 100644
@@ -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;
 	}
sound/soc/codecs/rt712-sdca.c +2 -6
index 19d99b9d4ab2..570c2af1245d 100644
@@ -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;
 	}
Signature · 1 line
2.49.0
maintainer
#1 lore raw
Quoted 8 lines · Colin Ian King

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

#2 lore raw

Hi Mark,

Looking at your repo I think you applied the V1 of the patch and not the V2.

Colin

Quoted 38 lines · Mark Brown
Quoted 8 lines · Colin Ian King

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

maintainer
#3 lore raw
Quoted 1 line · Colin King (gmail)

Looking at your repo I think you applied the V1 of the patch and not the V2.

Please submit an incremental patch with any changes you're looking for.

Please don't top post, reply in line with needed context. This allows readers to readily follow the flow of conversation and understand what you are talking about and also helps ensure that everything in the discussion is being addressed.