linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alban <albeu@free.fr>
To: Axel Lin <axel.lin@ingics.com>
Cc: Aban Bedel <albeu@free.fr>,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH] gpio: ath79: Check valid gpio count for both DT and non-DT cases
Date: Sat, 20 Feb 2016 19:11:41 +0100	[thread overview]
Message-ID: <20160220191141.395a64c5@tock> (raw)
In-Reply-To: <1455932887.31674.0.camel@ingics.com>

On Sat, 20 Feb 2016 09:48:07 +0800
Axel Lin <axel.lin@ingics.com> wrote:

> Move the code checking valid gpio count to cover both DT and non-DT cases.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Acked-by: Aban Bedel <albeu@free.fr>

> ---
>  drivers/gpio/gpio-ath79.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c
> index 018ea9d..c4f4cdd 100644
> --- a/drivers/gpio/gpio-ath79.c
> +++ b/drivers/gpio/gpio-ath79.c
> @@ -240,10 +240,6 @@ static int ath79_gpio_probe(struct platform_device *pdev)
>  			dev_err(&pdev->dev, "ngpios property is not valid\n");
>  			return err;
>  		}
> -		if (ath79_gpio_count >= 32) {
> -			dev_err(&pdev->dev, "ngpios must be less than 32\n");
> -			return -EINVAL;
> -		}
>  		oe_inverted = of_device_is_compatible(np, "qca,ar9340-gpio");
>  	} else if (pdata) {
>  		ath79_gpio_count = pdata->ngpios;
> @@ -253,6 +249,11 @@ static int ath79_gpio_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> +	if (ath79_gpio_count >= 32) {
> +		dev_err(&pdev->dev, "ngpios must be less than 32\n");
> +		return -EINVAL;
> +	}
> +
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	ctrl->base = devm_ioremap_nocache(
>  		&pdev->dev, res->start, resource_size(res));


  reply	other threads:[~2016-02-20 18:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-20  1:48 [PATCH] gpio: ath79: Check valid gpio count for both DT and non-DT cases Axel Lin
2016-02-20 18:11 ` Alban [this message]
2016-02-25  9:10 ` Linus Walleij

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=20160220191141.395a64c5@tock \
    --to=albeu@free.fr \
    --cc=axel.lin@ingics.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).