Skip to contentSkip to conversation

ASoC: tas2781: Initialize subblk_offset in tasdevice_process_block()

PATCH New Ian Rogers 1 participant 1 message Nov 19

Subsystems (3)
lore
Share & tools
lore

Ian Rogers

author
#0 lore raw

PATCH 1/1 ASoC: tas2781: Initialize subblk_offset in tasdevice_process_block()

When tasdevice_load_block_kernel() processes a per-channel firmware block (dev_idx != 0) for an amplifier channel whose is_loading flag is false, tasdevice_process_block() skips the channel via continue and returns an uninitialized stack variable subblk_offset, which the caller checks for negative error and adds to the firmware buffer offset.

Initialize subblk_offset to 0.

Found via Clang -Wconditional-uninitialized on an x86_64 allyesconfig build. Verified by building sound/soc/codecs/tas2781-fmwlib.o with LLVM=1 W=1 (-Werror) and -Wconditional-uninitialized; not runtime-tested on TAS2781 hardware.

Fixes 915f5eadebd2 ("ASoC: tas2781: firmware lib")
---
 sound/soc/codecs/tas2781-fmwlib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/tas2781-fmwlib.c +1 -1
index e6429b4c8dc5..a5e6734723ab 100644
@@ -897,7 +897,7 @@ static int tasdevice_process_block(void *context, unsigned char *data,
 	unsigned char dev_idx, int sublocksize)
 {
 	struct tasdevice_priv *tas_priv = (struct tasdevice_priv *)context;
-	int subblk_offset, chn, chnend, rc;
+	int subblk_offset = 0, chn, chnend, rc;
 	unsigned char subblk_typ = data[1];
 	int blktyp = dev_idx & 0xC0;
 	int idx = dev_idx & 0x3F;
Signature · 1 line
2.56.1.708.g77570a6a1d-goog