summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-aspeed.c
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2017-05-02 09:08:24 +0300
committerLinus Walleij <linus.walleij@linaro.org>2017-05-22 11:37:07 +0300
commitdf563c85de690ec0a1c7e49bd1d43ff743dfb1ce (patch)
treeceb9daec6cc521b4ef21beee675f40c50b9a8769 /drivers/gpio/gpio-aspeed.c
parent08332893e37af6ae779367e78e444f8f9571511d (diff)
downloadlinux-df563c85de690ec0a1c7e49bd1d43ff743dfb1ce.tar.xz
gpio: aspeed: Don't attempt to debounce if disabled
We warn the user at driver probe time that debouncing is disabled. However, if they request debouncing later on we print a confusing error message: gpio_aspeed 1e780000.gpio: Failed to convert 5000us to cycles at 0Hz: -524 Instead bail out when the clock is not present. Fixes: 5ae4cb94b3133 (gpio: aspeed: Add debounce support) Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-aspeed.c')
-rw-r--r--drivers/gpio/gpio-aspeed.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index ccea609676ee..4ca436e66bdb 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -646,6 +646,9 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset,
int rc;
int i;
+ if (!gpio->clk)
+ return -EINVAL;
+
rc = usecs_to_cycles(gpio, usecs, &requested_cycles);
if (rc < 0) {
dev_warn(chip->parent, "Failed to convert %luus to cycles at %luHz: %d\n",