Re: [PATCH v2 resend 07/18] ASoC: soc-core: move snd_soc_lookup_component()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Pierre-Louis

> > +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;
> > +
> > +	ret = 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;
> 
> The mix of continue and break in the same loop is odd.
> 
> can this be done with break only, e.g. (check the logic)
> 
> for_each_component(component) {
> 	if (dev == component->dev &&
> 	   (!driver_name ||
> 	    (driver_name == component->driver->name) ||
> 	    (strcmp(component->driver->name, driver_name) == 0))
> 		ret = component;
> 		break;
> }

Indeed !!
Will post follow-up patch

> > +	mutex_unlock(&client_mutex);
> > +
> > +	return ret;
> 
> usually 'return ret' is for an error code. It's odd to use it for a pointer.

Will fix.

Thank you for your help !!
Best regards
---
Kuninori Morimoto
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux