sound/soc/codecs/tlv320dac33.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
Use a flexible array member and struct_size to use one allocation.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
sound/soc/codecs/tlv320dac33.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index 605da1259fc6..223c49dfc450 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -91,7 +91,6 @@ struct tlv320dac33_priv {
int mode1_latency; /* latency caused by the i2c writes in
* us */
u8 burst_bclkdiv; /* BCLK divider value in burst mode */
- u8 *reg_cache;
unsigned int burst_rate; /* Interface speed in Burst modes */
int keep_bclk; /* Keep the BCLK continuously running
@@ -108,6 +107,8 @@ struct tlv320dac33_priv {
enum dac33_state state;
struct i2c_client *i2c;
+
+ u8 reg_cache[];
};
static const u8 dac33_reg[DAC33_CACHEREGNUM] = {
@@ -1477,15 +1478,12 @@ static int dac33_i2c_probe(struct i2c_client *client)
struct tlv320dac33_priv *dac33;
int ret, i;
- dac33 = devm_kzalloc(&client->dev, sizeof(struct tlv320dac33_priv),
+ dac33 = devm_kzalloc(&client->dev, struct_size(dac33, reg_cache, ARRAY_SIZE(dac33_reg)),
GFP_KERNEL);
if (dac33 == NULL)
return -ENOMEM;
- dac33->reg_cache = devm_kmemdup_array(&client->dev, dac33_reg, ARRAY_SIZE(dac33_reg),
- sizeof(dac33_reg[0]), GFP_KERNEL);
- if (!dac33->reg_cache)
- return -ENOMEM;
+ memcpy(dac33->reg_cache, dac33_reg, ARRAY_SIZE(dac33_reg));
dac33->i2c = client;
mutex_init(&dac33->mutex);
--
2.53.0
On Wed, 01 Apr 2026 19:50:40 -0700, Rosen Penev wrote:
> ASoC: codecs: tlv320dac33: remove kmemdup_array
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.1
Thanks!
[1/1] ASoC: codecs: tlv320dac33: remove kmemdup_array
https://git.kernel.org/broonie/sound/c/04cc47624a33
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
© 2016 - 2026 Red Hat, Inc.