Skip to contentSkip to conversation

ASoC: qcom: Two fixes from Clang warning audit

PATCH New Ian Rogers 1 participant 3 messages Nov 19

Subsystems (4)
lore
Share & tools
lore

Ian Rogers

author
#0 lore raw

cover ASoC: qcom: Two fixes from Clang warning audit

Two fixes in Qualcomm ASoC drivers found while auditing Clang warnings (-Wconditional-uninitialized and -Wassign-enum) on an x86_64 allyesconfig build:

1. Return early for non-HPH interpolators in rx_macro_hd2_control().
2. Return IRQ_NONE instead of -EINVAL on an invalid DAI ID in lpass_dma_interrupt_handler().

Build-tested with LLVM=1 W=1 (-Werror); not runtime-tested on Qualcomm audio hardware.

Ian Rogers (2):
ASoC: codecs: lpass-rx-macro: Return early for non-HPH interpolators
in HD2 control
ASoC: qcom: lpass-platform: Return IRQ_NONE on invalid DAI ID in DMA
ISR

 sound/soc/codecs/lpass-rx-macro.c | 2 ++
 sound/soc/qcom/lpass-platform.c   | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
2.56.1.708.g77570a6a1d-goog
author
#1 lore raw

PATCH 1/2 ASoC: codecs: lpass-rx-macro: Return early for non-HPH interpolators in HD2 control

rx_macro_enable_interp() invokes rx_macro_hd2_control() whenever rx->hph_hd2_mode is enabled, including for INTERP_AUX. However, rx_macro_hd2_control() only assigns hd2_scale_reg and hd2_enable_reg for INTERP_HPHL and INTERP_HPHR, leaving both u16 register offsets uninitialized on the stack for INTERP_AUX before testing
'if (hd2_enable_reg && ...)' and writing to random codec register addresses.

Return immediately in the default branch of switch (interp_idx).

Found via an x86_64 LLVM=1 (Clang 21.1.8) allyesconfig audit with -Wconditional-uninitialized enabled; fix and changelog drafted with an AI coding assistant. Build-tested under LLVM=1 W=1 (-Werror) and -Wconditional-uninitialized; not tested on Qualcomm LPASS audio hardware.

Fixes 4f692926f562 ("ASoC: codecs: lpass-rx-macro: add dapm widgets and route")
---
 sound/soc/codecs/lpass-rx-macro.c | 2 ++
 1 file changed, 2 insertions(+)
sound/soc/codecs/lpass-rx-macro.c +2 -0
index ab8a1c2b0489..84a3a47cf932 100644
@@ -2414,6 +2414,8 @@ static void rx_macro_hd2_control(struct snd_soc_component *component,
 		hd2_scale_reg = CDC_RX_RXn_RX_PATH_SEC3(rx, 1);
 		hd2_enable_reg = CDC_RX_RXn_RX_PATH_CFG0(rx, 1);
 		break;
+	default:
+		return;
 	}
 
 	if (hd2_enable_reg && SND_SOC_DAPM_EVENT_ON(event)) {
Signature · 1 line
2.56.1.708.g77570a6a1d-goog
author
#2 lore raw

PATCH 2/2 ASoC: qcom: lpass-platform: Return IRQ_NONE on invalid DAI ID in DMA ISR

In reply to Ian Rogers

In lpass_dma_interrupt_handler(), the default switch branch returns -EINVAL from an irqreturn_t handler, which triggers report_bad_irq() in note_interrupt() instead of reporting an unhandled interrupt.

Return IRQ_NONE, matching the other error paths in lpass_dma_interrupt_handler().

Found via Clang -Wassign-enum on an x86_64 allyesconfig build. Verified by building sound/soc/qcom/lpass-platform.o with LLVM=1 W=1 (-Werror) and -Wassign-enum; not runtime-tested on Qualcomm LPASS hardware.

Fixes 7cb37b7bd0d3 ("ASoC: qcom: Add support for lpass hdmi driver")
---
 sound/soc/qcom/lpass-platform.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/qcom/lpass-platform.c +3 -2
index dad4becf7579..45379604b689 100644
@@ -963,8 +963,9 @@ static irqreturn_t lpass_dma_interrupt_handler(
 		val = 0;
 	break;
 	default:
-	dev_err(soc_runtime->dev, "%s: invalid  %d interface\n", __func__, dai_id);
-	return -EINVAL;
+		dev_err(soc_runtime->dev, "%s: invalid %d interface\n",
+			__func__, dai_id);
+		return IRQ_NONE;
 	}
 	if (interrupts & LPAIF_IRQ_PER(chan)) {
 		rv = regmap_write_bits(map, reg, mask, (LPAIF_IRQ_PER(chan) | val));
Signature · 1 line
2.56.1.708.g77570a6a1d-goog