ASoC: dapm: fix debugfs read using path->connected

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/28735af3f59af8388ff5317f1faa3cf532af5dcf
Commit:     28735af3f59af8388ff5317f1faa3cf532af5dcf
Parent:     4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323
Refname:    refs/heads/master
Author:     KaiChieh Chuang <[email protected]>
AuthorDate: Mon Feb 5 13:00:00 2018 +0800
Committer:  Mark Brown <[email protected]>
CommitDate: Wed Feb 7 11:15:26 2018 +0000

    ASoC: dapm: fix debugfs read using path->connected
    
    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 <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
---
 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)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.