linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/4] ASoC: dapm: fix debugfs read using path->connected
@ 2018-02-09 21:22 Matthias Kaehlcke
  2018-02-09 21:25 ` Matthias Kaehlcke
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias Kaehlcke @ 2018-02-09 21:22 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Zhou, David Airlie,
	Harry Wentland, Tony Cheng, Dmytro Laktyushkin
  Cc: amd-gfx, dri-devel, linux-kernel, Guenter Roeck, Justin TerAvest,
	Craig Bergstrom, KaiChieh Chuang, Mark Brown, Matthias Kaehlcke

From: KaiChieh Chuang <kaichieh.chuang@mediatek.com>

This fix a bug in dapm_widget_power_read_file(),
where it may sent opposite order of source/sink widget
into the p->connected().

for example,
static int connected_check(source, sink);
{"w_sink", NULL, "w_source", connected_check}

the dapm_widget_power_read_file() will query p->connected()
in following case
	p->conneted("w_source", "w_sink")
	p->conneted("w_sink", "w_source")
we should avoid the last case, since it's the wrong order (source/sink)
as declared in snd_soc_dapm_route.

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
 sound/soc/soc-dapm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index a10b21cfc31e..ee6d9d9a3c5e 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2026,7 +2026,7 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
 	snd_soc_dapm_for_each_direction(dir) {
 		rdir = SND_SOC_DAPM_DIR_REVERSE(dir);
 		snd_soc_dapm_widget_for_each_path(w, dir, p) {
-			if (p->connected && !p->connected(w, p->node[rdir]))
+			if (p->connected && !p->connected(p->source, p->sink))
 				continue;
 
 			if (!p->connect)
-- 
2.16.0.rc1.238.g530d649a79-goog

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

* Re: [PATCH v3 1/4] ASoC: dapm: fix debugfs read using path->connected
  2018-02-09 21:22 [PATCH v3 1/4] ASoC: dapm: fix debugfs read using path->connected Matthias Kaehlcke
@ 2018-02-09 21:25 ` Matthias Kaehlcke
  0 siblings, 0 replies; 2+ messages in thread
From: Matthias Kaehlcke @ 2018-02-09 21:25 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Zhou, David Airlie,
	Harry Wentland, Tony Cheng, Dmytro Laktyushkin
  Cc: amd-gfx, dri-devel, linux-kernel, Guenter Roeck, Justin TerAvest,
	Craig Bergstrom, KaiChieh Chuang, Mark Brown

Sorry, I unintentionally 'recycled' git send-email parameters, please
ignore this patch :(

El Fri, Feb 09, 2018 at 01:22:13PM -0800 Matthias Kaehlcke ha dit:

> From: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
> 
> This fix a bug in dapm_widget_power_read_file(),
> where it may sent opposite order of source/sink widget
> into the p->connected().
> 
> for example,
> static int connected_check(source, sink);
> {"w_sink", NULL, "w_source", connected_check}
> 
> the dapm_widget_power_read_file() will query p->connected()
> in following case
> 	p->conneted("w_source", "w_sink")
> 	p->conneted("w_sink", "w_source")
> we should avoid the last case, since it's the wrong order (source/sink)
> as declared in snd_soc_dapm_route.
> 
> Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> ---
>  sound/soc/soc-dapm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index a10b21cfc31e..ee6d9d9a3c5e 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -2026,7 +2026,7 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
>  	snd_soc_dapm_for_each_direction(dir) {
>  		rdir = SND_SOC_DAPM_DIR_REVERSE(dir);
>  		snd_soc_dapm_widget_for_each_path(w, dir, p) {
> -			if (p->connected && !p->connected(w, p->node[rdir]))
> +			if (p->connected && !p->connected(p->source, p->sink))
>  				continue;
>  
>  			if (!p->connect)

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

end of thread, other threads:[~2018-02-09 21:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 21:22 [PATCH v3 1/4] ASoC: dapm: fix debugfs read using path->connected Matthias Kaehlcke
2018-02-09 21:25 ` Matthias Kaehlcke

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).