[PATCH] ASoC: core: Make sure component driver names are unique
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Mon May 11 03:41:53 CEST 2020
Hi Ranjani
> When registering a component, make sure that the driver names
> are unique. This will ensure that the snd_soc_rtdcom_lookup()
> function returns the right component based on the name.
>
> Signed-off-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
> ---
(snip)
> +static bool
> +snd_soc_component_driver_name_is_unique(const struct snd_soc_component_driver *component_driver)
> +{
> + struct snd_soc_component *component;
> +
> + mutex_lock(&client_mutex);
> + for_each_component(component)
> + if (!strcmp(component->driver->name, component_driver->name)) {
> + mutex_unlock(&client_mutex);
> + return false;
> + }
> +
> + mutex_unlock(&client_mutex);
> + return true;
> +}
I think it will be more readable if it doesn't have
multiple mutex_unlock().
{
int ret = true;
mutex_lock();
for_each_component()
if (...) {
...
ret = false;
}
mutex_unlock();
return ret;
}
Thank you for your help !!
Best regards
---
Kuninori Morimoto
More information about the Alsa-devel
mailing list