Skip to content

Commit 904ef2c

Browse files
geertudtor
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/d225a837c50e2b19a41555a8f7ce0f94b1689aa4.1689600353.git.geert+renesas@glider.be Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent dbce1a7 commit 904ef2c

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

drivers/input/keyboard/gpio_keys.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -523,18 +523,15 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
523523
NULL, GPIOD_IN, desc);
524524
if (IS_ERR(bdata->gpiod)) {
525525
error = PTR_ERR(bdata->gpiod);
526-
if (error == -ENOENT) {
527-
/*
528-
* GPIO is optional, we may be dealing with
529-
* purely interrupt-driven setup.
530-
*/
531-
bdata->gpiod = NULL;
532-
} else {
533-
if (error != -EPROBE_DEFER)
534-
dev_err(dev, "failed to get gpio: %d\n",
535-
error);
536-
return error;
537-
}
526+
if (error != -ENOENT)
527+
return dev_err_probe(dev, error,
528+
"failed to get gpio\n");
529+
530+
/*
531+
* GPIO is optional, we may be dealing with
532+
* purely interrupt-driven setup.
533+
*/
534+
bdata->gpiod = NULL;
538535
}
539536
} else if (gpio_is_valid(button->gpio)) {
540537
/*

0 commit comments

Comments
 (0)