All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: topology: Check w->sname validity once in sof_connect_dai_widget()
@ 2022-04-21 20:18 Pierre-Louis Bossart
  2022-04-22 23:17 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre-Louis Bossart @ 2022-04-21 20:18 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, Bard Liao, broonie, Peter Ujfalusi, Pierre-Louis Bossart

From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

The 'w' (struct snd_soc_dapm_widget) is not changing within the function,
there is no reason to check the w->sname more than once as it is not
going to change.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/topology.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 38e560ccaa570..5e959f8c4cb9d 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -1012,15 +1012,18 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp,
 	struct snd_soc_dai *cpu_dai;
 	int i;
 
+	if (!w->sname) {
+		dev_err(scomp->dev, "Widget %s does not have stream\n", w->name);
+		return -EINVAL;
+	}
+
 	list_for_each_entry(rtd, &card->rtd_list, list) {
 		dev_vdbg(scomp->dev, "tplg: check widget: %s stream: %s dai stream: %s\n",
 			 w->name,  w->sname, rtd->dai_link->stream_name);
 
-		if (!w->sname || !rtd->dai_link->stream_name)
-			continue;
-
 		/* does stream match DAI link ? */
-		if (strcmp(w->sname, rtd->dai_link->stream_name))
+		if (!rtd->dai_link->stream_name ||
+		    strcmp(w->sname, rtd->dai_link->stream_name))
 			continue;
 
 		switch (w->id) {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: SOF: topology: Check w->sname validity once in sof_connect_dai_widget()
  2022-04-21 20:18 [PATCH] ASoC: SOF: topology: Check w->sname validity once in sof_connect_dai_widget() Pierre-Louis Bossart
@ 2022-04-22 23:17 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2022-04-22 23:17 UTC (permalink / raw)
  To: alsa-devel, pierre-louis.bossart; +Cc: tiwai, peter.ujfalusi, yung-chuan.liao

On Thu, 21 Apr 2022 15:18:47 -0500, Pierre-Louis Bossart wrote:
> From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
> 
> The 'w' (struct snd_soc_dapm_widget) is not changing within the function,
> there is no reason to check the w->sname more than once as it is not
> going to change.
> 
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: SOF: topology: Check w->sname validity once in sof_connect_dai_widget()
      commit: 14bdc7b2f9ea0d3f86beed93079ce40a7ead57ac

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-22 23:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 20:18 [PATCH] ASoC: SOF: topology: Check w->sname validity once in sof_connect_dai_widget() Pierre-Louis Bossart
2022-04-22 23:17 ` Mark Brown

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.