Commit 904ef2c4 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Dmitry Torokhov

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: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/d225a837c50e2b19a41555a8f7ce0f94b1689aa4.1689600353.git.geert+renesas@glider.beSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent dbce1a7d
...@@ -523,18 +523,15 @@ static int gpio_keys_setup_key(struct platform_device *pdev, ...@@ -523,18 +523,15 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
NULL, GPIOD_IN, desc); NULL, GPIOD_IN, desc);
if (IS_ERR(bdata->gpiod)) { if (IS_ERR(bdata->gpiod)) {
error = PTR_ERR(bdata->gpiod); error = PTR_ERR(bdata->gpiod);
if (error == -ENOENT) { if (error != -ENOENT)
/* return dev_err_probe(dev, error,
* GPIO is optional, we may be dealing with "failed to get gpio\n");
* purely interrupt-driven setup.
*/ /*
bdata->gpiod = NULL; * GPIO is optional, we may be dealing with
} else { * purely interrupt-driven setup.
if (error != -EPROBE_DEFER) */
dev_err(dev, "failed to get gpio: %d\n", bdata->gpiod = NULL;
error);
return error;
}
} }
} else if (gpio_is_valid(button->gpio)) { } else if (gpio_is_valid(button->gpio)) {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment