linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: mrfld: fix incorrect check on p->sink
@ 2019-11-19 11:36 Colin King
  2019-11-19 14:23 ` Pierre-Louis Bossart
  2020-02-25 13:24 ` Applied "ASoC: Intel: mrfld: fix incorrect check on p->sink" to the asoc tree Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2019-11-19 11:36 UTC (permalink / raw)
  To: Cezary Rojewski, Pierre-Louis Bossart, Liam Girdwood, Jie Yang,
	Mark Brown, Jaroslav Kysela, Takashi Iwai, Subhransu S . Prusty,
	Vinod Koul, alsa-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The check on p->sink looks bogus, I believe it should be p->source
since the following code blocks are related to p->source. Fix
this by replacing p->sink with p->source.

Addresses-Coverity: ("Copy-paste error")
Fixes: 24c8d14192cc ("ASoC: Intel: mrfld: add DSP core controls")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---

[ Note: this has not been tested ]

---
 sound/soc/intel/atom/sst-atom-controls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c
index baef461a99f1..f883c9340eee 100644
--- a/sound/soc/intel/atom/sst-atom-controls.c
+++ b/sound/soc/intel/atom/sst-atom-controls.c
@@ -1333,7 +1333,7 @@ int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute)
 				dai->capture_widget->name);
 		w = dai->capture_widget;
 		snd_soc_dapm_widget_for_each_source_path(w, p) {
-			if (p->connected && !p->connected(w, p->sink))
+			if (p->connected && !p->connected(w, p->source))
 				continue;
 
 			if (p->connect &&  p->source->power &&
-- 
2.24.0


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

* Re: [PATCH] ASoC: Intel: mrfld: fix incorrect check on p->sink
  2019-11-19 11:36 [PATCH] ASoC: Intel: mrfld: fix incorrect check on p->sink Colin King
@ 2019-11-19 14:23 ` Pierre-Louis Bossart
  2020-02-25 13:24 ` Applied "ASoC: Intel: mrfld: fix incorrect check on p->sink" to the asoc tree Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Pierre-Louis Bossart @ 2019-11-19 14:23 UTC (permalink / raw)
  To: Colin King, Cezary Rojewski, Liam Girdwood, Jie Yang, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Subhransu S . Prusty, Vinod Koul,
	alsa-devel
  Cc: kernel-janitors, linux-kernel, Sanyog Kale



On 11/19/19 5:36 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The check on p->sink looks bogus, I believe it should be p->source
> since the following code blocks are related to p->source. Fix
> this by replacing p->sink with p->source.
> 
> Addresses-Coverity: ("Copy-paste error")
> Fixes: 24c8d14192cc ("ASoC: Intel: mrfld: add DSP core controls")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> 
> [ Note: this has not been tested ]
> 

wow, nice catch. this dates from October 2014 and was merged in Linux 3.19.

I did look at the entire function and indeed it does not seem logical at 
all and rather an unintentional bad copy-paste, probably undetected 
since changing the gains on capture is less straightforward to test.

	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
		dev_dbg(dai->dev, "Stream name=%s\n",
				dai->playback_widget->name);
		w = dai->playback_widget;
		snd_soc_dapm_widget_for_each_sink_path(w, p) {
			if (p->connected && !p->connected(w, p->sink))
				continue;
[snip]
		}
	} else {
		dev_dbg(dai->dev, "Stream name=%s\n",
				dai->capture_widget->name);
		w = dai->capture_widget;
		snd_soc_dapm_widget_for_each_source_path(w, p) {
			if (p->connected && !p->connected(w, p->sink))

<< here it doesn't look right to use sink here.

				continue;

This macro snd_soc_dapm_widget_for_each_source_path() is also used in 
the skylake/skl-topology.c but without any source/sink inversion.

I don't think anyone on the Intel side will have time to investigate 
further, and unless someone from the initial contributors states this 
was intentional (Vinod/Sanyog?), we should merge this.

let's see if there's any feedback and if not I'll ack this.


> ---
>   sound/soc/intel/atom/sst-atom-controls.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c
> index baef461a99f1..f883c9340eee 100644
> --- a/sound/soc/intel/atom/sst-atom-controls.c
> +++ b/sound/soc/intel/atom/sst-atom-controls.c
> @@ -1333,7 +1333,7 @@ int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute)
>   				dai->capture_widget->name);
>   		w = dai->capture_widget;
>   		snd_soc_dapm_widget_for_each_source_path(w, p) {
> -			if (p->connected && !p->connected(w, p->sink))
> +			if (p->connected && !p->connected(w, p->source))
>   				continue;
>   
>   			if (p->connect &&  p->source->power &&
> 

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

* Applied "ASoC: Intel: mrfld: fix incorrect check on p->sink" to the asoc tree
  2019-11-19 11:36 [PATCH] ASoC: Intel: mrfld: fix incorrect check on p->sink Colin King
  2019-11-19 14:23 ` Pierre-Louis Bossart
@ 2020-02-25 13:24 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-02-25 13:24 UTC (permalink / raw)
  To: Colin Ian King
  Cc: alsa-devel, Cezary Rojewski, Jaroslav Kysela, Jie Yang,
	kernel-janitors, Liam Girdwood, linux-kernel, Mark Brown,
	Pierre-Louis Bossart, Subhransu S . Prusty, Takashi Iwai,
	Vinod Koul

The patch

   ASoC: Intel: mrfld: fix incorrect check on p->sink

has been applied to the asoc tree at

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

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

From f5e056e1e46fcbb5f74ce560792aeb7d57ce79e6 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Tue, 19 Nov 2019 11:36:40 +0000
Subject: [PATCH] ASoC: Intel: mrfld: fix incorrect check on p->sink

The check on p->sink looks bogus, I believe it should be p->source
since the following code blocks are related to p->source. Fix
this by replacing p->sink with p->source.

Fixes: 24c8d14192cc ("ASoC: Intel: mrfld: add DSP core controls")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Addresses-Coverity: ("Copy-paste error")
Link: https://lore.kernel.org/r/20191119113640.166940-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/atom/sst-atom-controls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c
index baef461a99f1..f883c9340eee 100644
--- a/sound/soc/intel/atom/sst-atom-controls.c
+++ b/sound/soc/intel/atom/sst-atom-controls.c
@@ -1333,7 +1333,7 @@ int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute)
 				dai->capture_widget->name);
 		w = dai->capture_widget;
 		snd_soc_dapm_widget_for_each_source_path(w, p) {
-			if (p->connected && !p->connected(w, p->sink))
+			if (p->connected && !p->connected(w, p->source))
 				continue;
 
 			if (p->connect &&  p->source->power &&
-- 
2.20.1


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

end of thread, other threads:[~2020-02-25 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 11:36 [PATCH] ASoC: Intel: mrfld: fix incorrect check on p->sink Colin King
2019-11-19 14:23 ` Pierre-Louis Bossart
2020-02-25 13:24 ` Applied "ASoC: Intel: mrfld: fix incorrect check on p->sink" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).