summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2016-02-20 09:48:07 +0800
committerLinus Walleij <linus.walleij@linaro.org>2016-02-25 10:09:59 +0100
commit2b99d3279037631ca522cabf428c778a9b63163a (patch)
treec657553e3c634ef93ed1e6e561206120d57d1c09 /drivers/gpio
parent29821c2c611f1f4e4013fe68686375a2b84281c7 (diff)
downloadlinux-2b99d3279037631ca522cabf428c778a9b63163a.tar.bz2
gpio: ath79: Check valid gpio count for both DT and non-DT cases
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: Alban Bedel <albeu@free.fr> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-ath79.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c
index 018ea9d33b54..c4f4cddc7c1a 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));