]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: SDCA: correct the calculation of the maximum init table size
authorShuming Fan <shumingf@realtek.com>
Mon, 21 Jul 2025 11:23:34 +0000 (19:23 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 21 Jul 2025 15:04:47 +0000 (16:04 +0100)
One initial setting is 5 bytes, so num_init_writes should divide by 5.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250721112334.388506-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sdca/sdca_functions.c

index 64ac2644389070cc2c704f0589ff4d2018042abe..de213a69e0dacc08f75b496f7a755aab251fbf95 100644 (file)
@@ -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;
        }