diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2018-01-22 19:41:24 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-01-23 06:17:56 -0500 |
commit | 971da24c48a9447fb7a3c7805812fd5f443ca008 (patch) | |
tree | 00fb0782e837b6bc47176814918bab0df25f0294 | |
parent | 031734b7d6532633d0cde73475c30646bf37cd6d (diff) |
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 <vijendar.mukunda@amd.com>
Reported-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Mukunda,Vijendar <vijendar.mukunda@amd.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/soc-core.c | 12 |
1 files 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, | |||
590 | { | 590 | { |
591 | struct snd_soc_rtdcom_list *rtdcom; | 591 | struct snd_soc_rtdcom_list *rtdcom; |
592 | 592 | ||
593 | if (!driver_name) | ||
594 | return NULL; | ||
595 | |||
593 | for_each_rtdcom(rtd, rtdcom) { | 596 | for_each_rtdcom(rtd, rtdcom) { |
594 | if ((rtdcom->component->driver->name == driver_name) || | 597 | const char *component_name = rtdcom->component->driver->name; |
595 | strcmp(rtdcom->component->driver->name, driver_name) == 0) | 598 | |
599 | if (!component_name) | ||
600 | continue; | ||
601 | |||
602 | if ((component_name == driver_name) || | ||
603 | strcmp(component_name, driver_name) == 0) | ||
596 | return rtdcom->component; | 604 | return rtdcom->component; |
597 | } | 605 | } |
598 | 606 | ||