mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: tas2781: Initialize subblk_offset in tasdevice_process_block()
@ 2026-11-19 17:11 Ian Rogers
  0 siblings, 0 replies; only message in thread
From: Ian Rogers @ 2026-11-19 17:11 UTC (permalink / raw)
  To: Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: linux-sound, linux-kernel, llvm, Elkin Cruz, Ian Rogers

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")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 sound/soc/codecs/tas2781-fmwlib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c
index e6429b4c8dc5..a5e6734723ab 100644
--- a/sound/soc/codecs/tas2781-fmwlib.c
+++ b/sound/soc/codecs/tas2781-fmwlib.c
@@ -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;
-- 
2.56.1.708.g77570a6a1d-goog


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-19 17:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 17:11 [PATCH] ASoC: tas2781: Initialize subblk_offset in tasdevice_process_block() Ian Rogers

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®