diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2019-11-05 15:46:35 +0900 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-11-05 23:50:15 +0000 |
commit | 5bd7e08b3c5f3924259643e1f413e10ca6c97634 (patch) | |
tree | 00368bcd93056cc189f908ecc01ced99ff76b6c8 /sound | |
parent | b8132657990b5a09ad8e1c9e2c8efc20b5f9372a (diff) | |
download | lwn-5bd7e08b3c5f3924259643e1f413e10ca6c97634.tar.gz lwn-5bd7e08b3c5f3924259643e1f413e10ca6c97634.zip |
ASoC: soc-core: tidyup snd_soc_lookup_component()
snd_soc_lookup_component() is using mix of continue and break
in the same loop. It is odd.
This patch cleanup it.
Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/874kzi3jn8.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-core.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b71bddb30db1..acbaed4e4e9d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -360,25 +360,22 @@ struct snd_soc_component *snd_soc_lookup_component(struct device *dev, const char *driver_name) { struct snd_soc_component *component; - struct snd_soc_component *ret; + struct snd_soc_component *found_component; - ret = NULL; + found_component = NULL; mutex_lock(&client_mutex); for_each_component(component) { - if (dev != component->dev) - continue; - - if (driver_name && - (driver_name != component->driver->name) && - (strcmp(component->driver->name, driver_name) != 0)) - continue; - - ret = component; - break; + if ((dev == component->dev) && + (!driver_name || + (driver_name == component->driver->name) || + (strcmp(component->driver->name, driver_name) == 0))) { + found_component = component; + break; + } } mutex_unlock(&client_mutex); - return ret; + return found_component; } EXPORT_SYMBOL_GPL(snd_soc_lookup_component); |