ASoC: soc-core: snd_soc_rtdcom_lookup() cares component driver name

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/971da24c48a9447fb7a3c7805812fd5f443ca008
Commit:     971da24c48a9447fb7a3c7805812fd5f443ca008
Parent:     031734b7d6532633d0cde73475c30646bf37cd6d
Refname:    refs/heads/master
Author:     Kuninori Morimoto <[email protected]>
AuthorDate: Tue Jan 23 00:41:24 2018 +0000
Committer:  Mark Brown <[email protected]>
CommitDate: Tue Jan 23 11:17:56 2018 +0000

    ASoC: soc-core: snd_soc_rtdcom_lookup() cares component driver name
    
    snd_soc_rtdcom_lookup() look up component by uisng driver name.
    Then, it uses component->driver->name.
    Some driver might doesn't have it, thus it should care NULL pointer.
    This patch solve this issue.
    
    Reported-by: Mukunda,Vijendar <[email protected]>
    Reported-by: Manuel Lauss <[email protected]>
    Signed-off-by: Kuninori Morimoto <[email protected]>
    Tested-by: Mukunda,Vijendar <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
---
 sound/soc/soc-core.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9b79c2199781..52b2e04cc5e2 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -590,9 +590,17 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
 {
 	struct snd_soc_rtdcom_list *rtdcom;
 
+	if (!driver_name)
+		return NULL;
+
 	for_each_rtdcom(rtd, rtdcom) {
-		if ((rtdcom->component->driver->name == driver_name) ||
-		    strcmp(rtdcom->component->driver->name, driver_name) == 0)
+		const char *component_name = rtdcom->component->driver->name;
+
+		if (!component_name)
+			continue;
+
+		if ((component_name == driver_name) ||
+		    strcmp(component_name, driver_name) == 0)
 			return rtdcom->component;
 	}
 
--
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.