From: phucduc.bui@gmail.com
To: Yixun Lan <dlan@kernel.org>, Takashi Iwai <tiwai@suse.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Liam Girdwood <lgirdwood@gmail.com>
Cc: Troy Mitchell <troy.mitchell@linux.spacemit.com>,
Goko Mell <goku.sonxin626@gmail.com>,
Jinmei Wei <weijinmei@linux.spacemit.com>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
linux-riscv@lists.infradead.org, spacemit@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: spacemit: init *dp to NULL before error paths
Date: Fri, 31 Jul 2026 17:15:39 +0700 [thread overview]
Message-ID: <20260731101539.36290-2-phucduc.bui@gmail.com> (raw)
In-Reply-To: <20260731101539.36290-1-phucduc.bui@gmail.com>
From: bui duc phuc <phucduc.bui@gmail.com>
spacemit_i2s_init_dai() takes an optional output parameter dp, but only
assigns *dp on the success path. If devm_kmemdup() fails, *dp is left
untouched.
The current caller does check the return value before using dp, so this
isn't an active bug. Still, initialize *dp to NULL upfront as a defensive
measure, consistent with how core helpers like _snd_pcm_new() handle
their optional output parameters.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/spacemit/k1_i2s.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/spacemit/k1_i2s.c b/sound/soc/spacemit/k1_i2s.c
index 64510c9a1a89..23037fa4233c 100644
--- a/sound/soc/spacemit/k1_i2s.c
+++ b/sound/soc/spacemit/k1_i2s.c
@@ -382,6 +382,9 @@ static int spacemit_i2s_init_dai(struct spacemit_i2s_dev *i2s,
struct property *dma_names;
const char *dma_name;
+ if (dp)
+ *dp = NULL;
+
of_property_for_each_string(node, "dma-names", dma_names, dma_name) {
if (!strcmp(dma_name, "tx"))
i2s->has_playback = true;
--
2.43.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: phucduc.bui@gmail.com
To: Yixun Lan <dlan@kernel.org>, Takashi Iwai <tiwai@suse.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Liam Girdwood <lgirdwood@gmail.com>
Cc: Troy Mitchell <troy.mitchell@linux.spacemit.com>,
Goko Mell <goku.sonxin626@gmail.com>,
Jinmei Wei <weijinmei@linux.spacemit.com>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
linux-riscv@lists.infradead.org, spacemit@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: spacemit: init *dp to NULL before error paths
Date: Fri, 31 Jul 2026 17:15:39 +0700 [thread overview]
Message-ID: <20260731101539.36290-2-phucduc.bui@gmail.com> (raw)
In-Reply-To: <20260731101539.36290-1-phucduc.bui@gmail.com>
From: bui duc phuc <phucduc.bui@gmail.com>
spacemit_i2s_init_dai() takes an optional output parameter dp, but only
assigns *dp on the success path. If devm_kmemdup() fails, *dp is left
untouched.
The current caller does check the return value before using dp, so this
isn't an active bug. Still, initialize *dp to NULL upfront as a defensive
measure, consistent with how core helpers like _snd_pcm_new() handle
their optional output parameters.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/spacemit/k1_i2s.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/spacemit/k1_i2s.c b/sound/soc/spacemit/k1_i2s.c
index 64510c9a1a89..23037fa4233c 100644
--- a/sound/soc/spacemit/k1_i2s.c
+++ b/sound/soc/spacemit/k1_i2s.c
@@ -382,6 +382,9 @@ static int spacemit_i2s_init_dai(struct spacemit_i2s_dev *i2s,
struct property *dma_names;
const char *dma_name;
+ if (dp)
+ *dp = NULL;
+
of_property_for_each_string(node, "dma-names", dma_names, dma_name) {
if (!strcmp(dma_name, "tx"))
i2s->has_playback = true;
--
2.43.0
next prev parent reply other threads:[~2026-07-31 10:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 10:15 [PATCH 1/2] ASoC: spacemit: Drop redundant error messages phucduc.bui
2026-07-31 10:15 ` phucduc.bui
2026-07-31 10:15 ` phucduc.bui [this message]
2026-07-31 10:15 ` [PATCH 2/2] ASoC: spacemit: init *dp to NULL before error paths phucduc.bui
2026-08-03 2:29 ` Troy Mitchell
2026-08-03 2:29 ` Troy Mitchell
2026-08-03 4:05 ` Bui Duc Phuc
2026-08-03 4:05 ` Bui Duc Phuc
2026-08-03 4:07 ` Bui Duc Phuc
2026-08-03 4:07 ` Bui Duc Phuc
2026-08-03 6:38 ` Troy Mitchell
2026-08-03 6:38 ` Troy Mitchell
2026-08-04 3:41 ` Bui Duc Phuc
2026-08-04 3:41 ` Bui Duc Phuc
2026-08-03 6:37 ` Troy Mitchell
2026-08-03 6:37 ` Troy Mitchell
2026-08-04 3:38 ` Bui Duc Phuc
2026-08-04 3:38 ` Bui Duc Phuc
2026-08-03 2:30 ` [PATCH 1/2] ASoC: spacemit: Drop redundant error messages Troy Mitchell
2026-08-03 2:30 ` Troy Mitchell
2026-08-03 18:37 ` (subset) " Mark Brown
2026-08-03 18:37 ` 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=20260731101539.36290-2-phucduc.bui@gmail.com \
--to=phucduc.bui@gmail.com \
--cc=broonie@kernel.org \
--cc=dlan@kernel.org \
--cc=goku.sonxin626@gmail.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=spacemit@lists.linux.dev \
--cc=tiwai@suse.com \
--cc=troy.mitchell@linux.spacemit.com \
--cc=weijinmei@linux.spacemit.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.