diff options
author | 2025-05-16 14:10:07 +0100 | |
---|---|---|
committer | 2025-05-20 11:15:37 +0100 | |
commit | 3849c958eeeb8e340112b983068c5547babc7274 (patch) | |
tree | 96795a5a54df0a2f67759b45847227add58121fc /sound | |
parent | ASoC: SDCA: Remove regmap module macros (diff) | |
download | wireguard-linux-3849c958eeeb8e340112b983068c5547babc7274.tar.xz wireguard-linux-3849c958eeeb8e340112b983068c5547babc7274.zip |
ASoC: SDCA: Move allocation of PDE delays array
Move the allocation of the PDE delays array until after the size has
been adjusted, this saves an additional division and simplifies the
code slightly.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Link: https://patch.msgid.link/20250516131011.221310-4-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/sdca/sdca_functions.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c index 493f390f087a..64ac26443890 100644 --- a/sound/soc/sdca/sdca_functions.c +++ b/sound/soc/sdca/sdca_functions.c @@ -1105,12 +1105,6 @@ static int find_sdca_entity_pde(struct device *dev, return -EINVAL; } - /* There are 3 values per delay */ - delays = devm_kcalloc(dev, num_delays / mult_delay, - sizeof(*delays), GFP_KERNEL); - if (!delays) - return -ENOMEM; - delay_list = kcalloc(num_delays, sizeof(*delay_list), GFP_KERNEL); if (!delay_list) return -ENOMEM; @@ -1121,6 +1115,10 @@ static int find_sdca_entity_pde(struct device *dev, num_delays /= mult_delay; + delays = devm_kcalloc(dev, num_delays, sizeof(*delays), GFP_KERNEL); + if (!delays) + return -ENOMEM; + for (i = 0, j = 0; i < num_delays; i++) { delays[i].from_ps = delay_list[j++]; delays[i].to_ps = delay_list[j++]; |