All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang@pengutronix.de>
To: Sourav Poddar <sourav.poddar@ti.com>
Cc: LW@karo-electronics.de, Dmitry Torokhov <dtor@mail.ru>,
	balbi@ti.com, Kishon Vijay Abraham I <kishon@ti.com>,
	charu@ti.com, grinberg@compulab.co.il,
	linux-input@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, gadiyar@ti.com
Subject: Re: [PATCH v3 1/2] ads7846: fix gpio free without requesting
Date: Thu, 3 Feb 2011 16:47:05 +0100	[thread overview]
Message-ID: <20110203154705.GE6508@pengutronix.de> (raw)
In-Reply-To: <1296746486-12168-1-git-send-email-sourav.poddar@ti.com>

[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]

On Thu, Feb 03, 2011 at 08:51:26PM +0530, Sourav Poddar wrote:
> gpio_pendown in ads7846_probe is not getting initalized (defaulted to 0)
> resulting in gpio_free being called without a gpio_request. This
> results in the following backtrace in bootup (at least on an OMAP3430 SDP).

I wonder if it makes sense to merge both patches under the name of "fix
gpio-handling" or similar. Not sure, though...

> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index 14ea54b..ce5baee 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -952,6 +952,7 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>  
>  	if (pdata->get_pendown_state) {
>  		ts->get_pendown_state = pdata->get_pendown_state;
> +		ts->gpio_pendown = -EINVAL;
>  		return 0;
>  	}

Will probably work, but maybe it is better to reorganize the code to
just have one success-exit-point. That would be mean adding an else
branch to this if-block.

>  
> @@ -1353,7 +1354,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
>   err_put_regulator:
>  	regulator_put(ts->reg);
>   err_free_gpio:
> -	if (ts->gpio_pendown != -1)
> +	if (gpio_is_valid(ts->gpio_pendown))

You could do the same in the remove-path.

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: w.sang@pengutronix.de (Wolfram Sang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/2] ads7846: fix gpio free without requesting
Date: Thu, 3 Feb 2011 16:47:05 +0100	[thread overview]
Message-ID: <20110203154705.GE6508@pengutronix.de> (raw)
In-Reply-To: <1296746486-12168-1-git-send-email-sourav.poddar@ti.com>

On Thu, Feb 03, 2011 at 08:51:26PM +0530, Sourav Poddar wrote:
> gpio_pendown in ads7846_probe is not getting initalized (defaulted to 0)
> resulting in gpio_free being called without a gpio_request. This
> results in the following backtrace in bootup (at least on an OMAP3430 SDP).

I wonder if it makes sense to merge both patches under the name of "fix
gpio-handling" or similar. Not sure, though...

> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index 14ea54b..ce5baee 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -952,6 +952,7 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>  
>  	if (pdata->get_pendown_state) {
>  		ts->get_pendown_state = pdata->get_pendown_state;
> +		ts->gpio_pendown = -EINVAL;
>  		return 0;
>  	}

Will probably work, but maybe it is better to reorganize the code to
just have one success-exit-point. That would be mean adding an else
branch to this if-block.

>  
> @@ -1353,7 +1354,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
>   err_put_regulator:
>  	regulator_put(ts->reg);
>   err_free_gpio:
> -	if (ts->gpio_pendown != -1)
> +	if (gpio_is_valid(ts->gpio_pendown))

You could do the same in the remove-path.

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110203/e9a581ac/attachment-0001.sig>

  reply	other threads:[~2011-02-03 15:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03 15:21 [PATCH v3 1/2] ads7846: fix gpio free without requesting Sourav Poddar
2011-02-03 15:21 ` Sourav Poddar
2011-02-03 15:47 ` Wolfram Sang [this message]
2011-02-03 15:47   ` Wolfram Sang
2011-02-03 16:29   ` Igor Grinberg
2011-02-03 16:29     ` Igor Grinberg
2011-02-03 16:48     ` Wolfram Sang
2011-02-03 16:48       ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110203154705.GE6508@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=LW@karo-electronics.de \
    --cc=balbi@ti.com \
    --cc=charu@ti.com \
    --cc=dtor@mail.ru \
    --cc=gadiyar@ti.com \
    --cc=grinberg@compulab.co.il \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=sourav.poddar@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.