ASoC: fixup snd_soc_lookup_component_nolocked()

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Because snd_dmaengine_pcm is sharing same dev with CPU and Platform,
snd_soc_lookup_component_nolocked() might be call with NULL driver name
(= CPU). This patch fixup and cleanup it.
This commit is contained in:
Mark Brown 2025-08-25 21:16:07 +01:00
commit ebba78e34d
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -369,20 +369,25 @@ struct snd_soc_component
*snd_soc_lookup_component_nolocked(struct device *dev, const char *driver_name)
{
struct snd_soc_component *component;
struct snd_soc_component *found_component;
found_component = NULL;
for_each_component(component) {
if ((dev == component->dev) &&
(!driver_name ||
(driver_name == component->driver->name) ||
(strcmp(component->driver->name, driver_name) == 0))) {
found_component = component;
break;
}
if (dev != component->dev)
continue;
if (!driver_name)
return component;
if (!component->driver->name)
continue;
if (component->driver->name == driver_name)
return component;
if (strcmp(component->driver->name, driver_name) == 0)
return component;
}
return found_component;
return NULL;
}
EXPORT_SYMBOL_GPL(snd_soc_lookup_component_nolocked);