[PATCH] ASoC: tlv320adcx140: zero-initialize the GPI configuration array

From: Yuehong Wu

Date: Thu Nov 05 2026 - 05:42:16 EST


adcx140_codec_probe() accepts any "ti,gpi-config" array with 1 to 4
entries (the DT binding has minItems: 1, maxItems: 4) but then always
reads all four elements to build the GPI_CFG0 and GPI_CFG1 register
values. With fewer than four entries the remaining elements of the
on-stack gpi_inputs[] array are uninitialized and the garbage is
shifted and written into the codec's GPI configuration registers.

The binding documents a default of <0 0 0 0>, i.e. unspecified GPI pins
are disabled, so zero-initialize the array and keep accepting short
arrays.

Found by code review with the help of an AI coding assistant. I do not
have TLV320ADCX140 hardware, so this was only compile-tested
(CONFIG_SND_SOC_TLV320ADCX140=m).

Fixes: 3c35e79cead3 ("ASoC: tlv320adcx140: Add support for configuring GPI pins")
Signed-off-by: Yuehong Wu <wuyuehong@xxxxxxxxxxxxxxxxxxxx>
---
sound/soc/codecs/tlv320adcx140.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index c29584d..511d691 100644
--- a/sound/soc/codecs/tlv320adcx140.c
+++ b/sound/soc/codecs/tlv320adcx140.c
@@ -1018,7 +1018,7 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
u32 pdm_edges[ADCX140_NUM_PDM_EDGES];
u32 pdm_edge_val = 0;
int gpi_count;
- u32 gpi_inputs[ADCX140_NUM_GPI_PINS];
+ u32 gpi_inputs[ADCX140_NUM_GPI_PINS] = {};
u32 gpi_input_val = 0;
int i;
int ret;
--
2.43.0