Skip to content

Commit ebba78e

Browse files
committed
ASoC: fixup snd_soc_lookup_component_nolocked()
Merge series from Kuninori Morimoto <[email protected]>: 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.
2 parents b1c99d5 + b833b41 commit ebba78e

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

sound/soc/soc-core.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -369,20 +369,25 @@ struct snd_soc_component
369369
*snd_soc_lookup_component_nolocked(struct device *dev, const char *driver_name)
370370
{
371371
struct snd_soc_component *component;
372-
struct snd_soc_component *found_component;
373372

374-
found_component = NULL;
375373
for_each_component(component) {
376-
if ((dev == component->dev) &&
377-
(!driver_name ||
378-
(driver_name == component->driver->name) ||
379-
(strcmp(component->driver->name, driver_name) == 0))) {
380-
found_component = component;
381-
break;
382-
}
374+
if (dev != component->dev)
375+
continue;
376+
377+
if (!driver_name)
378+
return component;
379+
380+
if (!component->driver->name)
381+
continue;
382+
383+
if (component->driver->name == driver_name)
384+
return component;
385+
386+
if (strcmp(component->driver->name, driver_name) == 0)
387+
return component;
383388
}
384389

385-
return found_component;
390+
return NULL;
386391
}
387392
EXPORT_SYMBOL_GPL(snd_soc_lookup_component_nolocked);
388393

0 commit comments

Comments
 (0)