From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Brown Subject: Re: [PATCH] ASoC: Add GPIO support for jack reporting interface Date: Tue, 3 Mar 2009 18:42:57 +0000 Message-ID: <20090303184257.GJ27155@sirena.org.uk> References: <2C7D3DF36ADFFC479B44490D912B616705ECD6D7C1@dlee07.ent.ti.com> <2C7D3DF36ADFFC479B44490D912B616705ECD6DB74@dlee07.ent.ti.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from cassiel.sirena.org.uk (cassiel.sirena.org.uk [80.68.93.111]) by alsa0.perex.cz (Postfix) with ESMTP id 99960103823 for ; Tue, 3 Mar 2009 19:42:59 +0100 (CET) Content-Disposition: inline In-Reply-To: <2C7D3DF36ADFFC479B44490D912B616705ECD6DB74@dlee07.ent.ti.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: "Lopez Cruz, Misael" Cc: Takashi Iwai , "alsa-devel@alsa-project.org" List-Id: alsa-devel@alsa-project.org On Tue, Mar 03, 2009 at 12:39:17PM -0600, Lopez Cruz, Misael wrote: > > I prefer GPIO stuff built in conditionally. > > The jack layer is used also for non-ASoC codes, and GPIO > > isn't always present. > Is it ok if I enclose all gpio functionality with #ifdef CONFIG_GPIOLIB? Yes, that's fine. > > 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.