Linux Sound subsystem development
 help / color / mirror / Atom feed
From: phucduc.bui@gmail.com
To: Chen Wang <chen.wang@linux.dev>, Takashi Iwai <tiwai@suse.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Liam Girdwood <lgirdwood@gmail.com>
Cc: Inochi Amaoto <inochiama@gmail.com>,
	stavinsky@gmail.com, sophgo@lists.linux.dev,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH 2/2] ASoC: sophgo: remove unneeded devm_kmemdup() for DAI driver
Date: Mon,  3 Aug 2026 13:16:05 +0700	[thread overview]
Message-ID: <20260803061605.35485-2-phucduc.bui@gmail.com> (raw)
In-Reply-To: <20260803061605.35485-1-phucduc.bui@gmail.com>

From: bui duc phuc <phucduc.bui@gmail.com>

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>
---
 sound/soc/sophgo/cv1800b-tdm.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/sound/soc/sophgo/cv1800b-tdm.c b/sound/soc/sophgo/cv1800b-tdm.c
index a97f775aeddc..4badb6e3e08b 100644
--- a/sound/soc/sophgo/cv1800b-tdm.c
+++ b/sound/soc/sophgo/cv1800b-tdm.c
@@ -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;
 
-- 
2.43.0


      reply	other threads:[~2026-08-03  6:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  6:16 [PATCH 1/2] ASoC: sophgo: Drop redundant error messages phucduc.bui
2026-08-03  6:16 ` phucduc.bui [this message]

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=20260803061605.35485-2-phucduc.bui@gmail.com \
    --to=phucduc.bui@gmail.com \
    --cc=broonie@kernel.org \
    --cc=chen.wang@linux.dev \
    --cc=inochiama@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=sophgo@lists.linux.dev \
    --cc=stavinsky@gmail.com \
    --cc=tiwai@suse.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