Skip to content

Commit 735fd6b

Browse files
committed
Input: gpio_keys_polled - simplify with dev_err_probe()
JIRA: https://issues.redhat.com/browse/RHEL-52234 commit caec3d4 Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Date: Sun, 25 Jun 2023 18:27:54 +0200 Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230625162817.100397-2-krzysztof.kozlowski@linaro.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
1 parent 4977754 commit 735fd6b

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/input/keyboard/gpio_keys_polled.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
299299
NULL, GPIOD_IN,
300300
button->desc);
301301
if (IS_ERR(bdata->gpiod)) {
302-
error = PTR_ERR(bdata->gpiod);
303-
if (error != -EPROBE_DEFER)
304-
dev_err(dev,
305-
"failed to get gpio: %d\n",
306-
error);
307302
fwnode_handle_put(child);
308-
return error;
303+
return dev_err_probe(dev, PTR_ERR(bdata->gpiod),
304+
"failed to get gpio\n");
309305
}
310306
} else if (gpio_is_valid(button->gpio)) {
311307
/*

0 commit comments

Comments
 (0)