ASoC: sophgo: remove unneeded devm_kmemdup() for DAI driver

cv1800b_i2s_dai_template is never modified on a per-instance basis, so
there is no need to duplicate it before registering the component.

Pass the template directly to devm_snd_soc_register_component(), remove
the now-unused local dai pointer, and drop the template's const qualifier
to match the current ASoC API.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260803061605.35485-2-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
bui duc phuc 2026-08-03 13:16:05 +07:00 committed by Mark Brown
parent 85665ff342
commit 6d0451f9bf
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -558,7 +558,7 @@ static const struct snd_soc_dai_ops cv1800b_i2s_dai_ops = {
.set_sysclk = cv1800b_i2s_dai_set_sysclk,
};
static const struct snd_soc_dai_driver cv1800b_i2s_dai_template = {
static struct snd_soc_dai_driver cv1800b_i2s_dai_template = {
.name = "cv1800b-i2s",
.playback = {
.stream_name = "Playback",
@ -636,7 +636,6 @@ static int cv1800b_i2s_probe(struct platform_device *pdev)
struct cv1800b_i2s *i2s;
struct resource *res;
void __iomem *regs;
struct snd_soc_dai_driver *dai;
int ret;
i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL);
@ -666,13 +665,8 @@ static int cv1800b_i2s_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, i2s);
cv1800b_i2s_setup_tdm(i2s);
dai = devm_kmemdup(dev, &cv1800b_i2s_dai_template, sizeof(*dai),
GFP_KERNEL);
if (!dai)
return -ENOMEM;
ret = devm_snd_soc_register_component(dev, &cv1800b_i2s_component, dai,
1);
ret = devm_snd_soc_register_component(dev, &cv1800b_i2s_component,
&cv1800b_i2s_dai_template, 1);
if (ret)
return ret;