From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: broonie@kernel.org
Cc: lgirdwood@gmail.com, pierre-louis.bossart@linux.dev,
peter.ujfalusi@linux.intel.com, yung-chuan.liao@linux.intel.com,
linux-sound@vger.kernel.org, patches@opensource.cirrus.com
Subject: [PATCH v6 3/7] ASoC: SDCA: Move allocation of PDE delays array
Date: Fri, 16 May 2025 14:10:07 +0100 [thread overview]
Message-ID: <20250516131011.221310-4-ckeepax@opensource.cirrus.com> (raw)
In-Reply-To: <20250516131011.221310-1-ckeepax@opensource.cirrus.com>
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>
---
No change since v5.
sound/soc/sdca/sdca_functions.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c
index 493f390f087ad..64ac264438907 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++];
--
2.39.5
next prev parent reply other threads:[~2025-05-16 13:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-16 13:10 [PATCH v6 0/7] Add DAPM/ASoC helpers to create SDCA drivers Charles Keepax
2025-05-16 13:10 ` [PATCH v6 1/7] ASoC: SDCA: Fix minor typo Charles Keepax
2025-05-16 13:10 ` [PATCH v6 2/7] ASoC: SDCA: Remove regmap module macros Charles Keepax
2025-05-16 13:10 ` Charles Keepax [this message]
2025-05-16 13:10 ` [PATCH v6 4/7] ASoC: dapm: Add component level pin switches Charles Keepax
2025-05-16 13:10 ` [PATCH v6 5/7] ASoC: SDCA: Create DAPM widgets and routes from DisCo Charles Keepax
2025-05-16 13:10 ` [PATCH v6 6/7] ASoC: SDCA: Create ALSA controls " Charles Keepax
2025-05-16 13:10 ` [PATCH v6 7/7] ASoC: SDCA: Create DAI drivers " Charles Keepax
2025-05-19 18:07 ` [PATCH v6 0/7] Add DAPM/ASoC helpers to create SDCA drivers Pierre-Louis Bossart
2025-05-22 8:45 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250516131011.221310-4-ckeepax@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox