diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2023-07-17 17:50:36 +0200 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2023-07-17 19:03:08 +0200 |
commit | 904ef2c47d8f3d0f0c7d5c0dd68ecc95908d7360 (patch) | |
tree | f75f24f76f6b6c56ff6e620c744fa762b52ece03 /drivers/input | |
parent | Input: Explicitly include correct DT includes (diff) | |
download | linux-904ef2c47d8f3d0f0c7d5c0dd68ecc95908d7360.tar.xz linux-904ef2c47d8f3d0f0c7d5c0dd68ecc95908d7360.zip |
Input: gpio-keys - convert to dev_err_probe()
Use the dev_err_probe() helper, instead of open-coding the same
operation.
While at it, invert the error checking logic to simplify code flow.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/d225a837c50e2b19a41555a8f7ce0f94b1689aa4.1689600353.git.geert+renesas@glider.be
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/keyboard/gpio_keys.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index c928829a8b0c..2e7c2c046e67 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -523,18 +523,15 @@ static int gpio_keys_setup_key(struct platform_device *pdev, NULL, GPIOD_IN, desc); if (IS_ERR(bdata->gpiod)) { error = PTR_ERR(bdata->gpiod); - if (error == -ENOENT) { - /* - * GPIO is optional, we may be dealing with - * purely interrupt-driven setup. - */ - bdata->gpiod = NULL; - } else { - if (error != -EPROBE_DEFER) - dev_err(dev, "failed to get gpio: %d\n", - error); - return error; - } + if (error != -ENOENT) + return dev_err_probe(dev, error, + "failed to get gpio\n"); + + /* + * GPIO is optional, we may be dealing with + * purely interrupt-driven setup. + */ + bdata->gpiod = NULL; } } else if (gpio_is_valid(button->gpio)) { /* |