[PATCH] ASoC: simple-card-utils: Check device node before overwrite direction

Shengjiu Wang posted 1 patch 1 month, 1 week ago
sound/soc/generic/simple-card-utils.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] ASoC: simple-card-utils: Check device node before overwrite direction
Posted by Shengjiu Wang 1 month, 1 week ago
Even the device node don't exist, the graph_util_parse_link_direction()
will overwrite the playback_only and capture_only to be zero. Which
cause the playback_only and capture_only are not correct, so check device
node exist or not before update the value.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/soc/generic/simple-card-utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 355f7ec8943c..bdc02e85b089 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -1179,9 +1179,9 @@ void graph_util_parse_link_direction(struct device_node *np,
 	bool is_playback_only = of_property_read_bool(np, "playback-only");
 	bool is_capture_only  = of_property_read_bool(np, "capture-only");
 
-	if (playback_only)
+	if (np && playback_only)
 		*playback_only = is_playback_only;
-	if (capture_only)
+	if (np && capture_only)
 		*capture_only = is_capture_only;
 }
 EXPORT_SYMBOL_GPL(graph_util_parse_link_direction);
-- 
2.34.1
Re: [PATCH] ASoC: simple-card-utils: Check device node before overwrite direction
Posted by Mark Brown 1 month ago
On Mon, 29 Dec 2025 17:04:32 +0800, Shengjiu Wang wrote:
> Even the device node don't exist, the graph_util_parse_link_direction()
> will overwrite the playback_only and capture_only to be zero. Which
> cause the playback_only and capture_only are not correct, so check device
> node exist or not before update the value.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: simple-card-utils: Check device node before overwrite direction
      commit: 22a507d7680f2c3499c133f6384349f62f916176

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
Re: [PATCH] ASoC: simple-card-utils: Check device node before overwrite direction
Posted by Kuninori Morimoto 1 month ago
Hi

> Even the device node don't exist, the graph_util_parse_link_direction()
> will overwrite the playback_only and capture_only to be zero. Which
> cause the playback_only and capture_only are not correct, so check device
> node exist or not before update the value.
> 
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thank you for your help !!

Best regards
---
Kuninori Morimoto