aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
authorRosen Penev <rosenp@gmail.com>2026-05-11 16:03:51 -0700
committerMark Brown <broonie@kernel.org>2026-05-16 11:30:33 +0900
commite0014849e9af1e08aaaf2b7bc26b1918d8275f24 (patch)
tree62514c6be45d8a8d2db3599dae32339d7d0ab930 /sound
parentfea3df9eab74863b6d388fc71357342e25c5e877 (diff)
downloadlinux-next-history-e0014849e9af1e08aaaf2b7bc26b1918d8275f24.tar.gz
ASoC: sigmadsp: Use flexible array for control cache
Allocate SigmaDSP controls with kzalloc_flex() for the trailing cache data instead of open-coding the size calculation. Annotate the cache array with its existing byte count so the allocation helper can initialize the counter. Assisted-by: Codex:GPT-5.5 Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://patch.msgid.link/20260511230351.28868-1-rosenp@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/sigmadsp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c
index 3343dbb63d2b7..2e08fde3989c2 100644
--- a/sound/soc/codecs/sigmadsp.c
+++ b/sound/soc/codecs/sigmadsp.c
@@ -35,7 +35,7 @@ struct sigmadsp_control {
struct snd_kcontrol *kcontrol;
bool is_readback;
bool cached;
- uint8_t cache[];
+ u8 cache[] __counted_by(num_bytes);
};
struct sigmadsp_data {
@@ -223,7 +223,7 @@ static int sigma_fw_load_control(struct sigmadsp *sigmadsp,
return -EINVAL;
num_bytes = le16_to_cpu(ctrl_chunk->num_bytes);
- ctrl = kzalloc(sizeof(*ctrl) + num_bytes, GFP_KERNEL);
+ ctrl = kzalloc_flex(*ctrl, cache, num_bytes);
if (!ctrl)
return -ENOMEM;