From: Shuming Fan Date: Mon, 21 Jul 2025 11:23:34 +0000 (+0800) Subject: ASoC: SDCA: correct the calculation of the maximum init table size X-Git-Tag: v6.16~13^2^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9e55f1192648a5b327f03c60e411126b3d19c5c5;p=thirdparty%2Flinux.git ASoC: SDCA: correct the calculation of the maximum init table size One initial setting is 5 bytes, so num_init_writes should divide by 5. Signed-off-by: Shuming Fan Reviewed-by: Charles Keepax Link: https://patch.msgid.link/20250721112334.388506-1-shumingf@realtek.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c index 64ac264438907..de213a69e0dac 100644 --- a/sound/soc/sdca/sdca_functions.c +++ b/sound/soc/sdca/sdca_functions.c @@ -211,7 +211,7 @@ static int find_sdca_init_table(struct device *dev, } else if (num_init_writes % sizeof(*raw) != 0) { dev_err(dev, "%pfwP: init table size invalid\n", function_node); return -EINVAL; - } else if (num_init_writes > SDCA_MAX_INIT_COUNT) { + } else if ((num_init_writes / sizeof(*raw)) > SDCA_MAX_INIT_COUNT) { dev_err(dev, "%pfwP: maximum init table size exceeded\n", function_node); return -EINVAL; }