> > > This error path doesn't look good. It seems leaking / > > > keeping some resources. > > Changed to: > > int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, > > struct snd_soc_jack_gpio *gpios) > > { > > int i, ret; > > > > for (i = 0; i < count; i++) { > > if (!gpio_is_valid(gpios[i].gpio)) { > > printk(KERN_ERR "Invalid gpio %d\n", > > gpios[i].gpio); > > return -EINVAL; > > } > This still leaks GPIOs and interrupts if one of these tests fails on a > GPIO after the first. I was thinking more in that machine drivers could handle the returned error, for example, calling snd_soc_jack_free_gpios. ret = snd_soc_jack_add_gpios(jack, ARRAY_SIZE(my_array), my_array); if (ret) { snd_soc_jack_free_gpios(jack, ARRAY_SIZE(my_array), my_array); return ret; } But if snd_soc_jack_add_gpios() has to take care of it, then I'll add that. _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel