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>
This commit is contained in:
Kuninori Morimoto 2018-01-23 00:41:24 +00:00 committed by Mark Brown
parent 031734b7d6
commit 971da24c48
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -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;
}