Commit 1e402a15 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Dmitry Torokhov

Input: rotary_encoder - simplify with dev_err_probe()

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: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20230625162817.100397-5-krzysztof.kozlowski@linaro.orgSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent a07e68df
...@@ -236,12 +236,8 @@ static int rotary_encoder_probe(struct platform_device *pdev) ...@@ -236,12 +236,8 @@ static int rotary_encoder_probe(struct platform_device *pdev)
device_property_read_bool(dev, "rotary-encoder,relative-axis"); device_property_read_bool(dev, "rotary-encoder,relative-axis");
encoder->gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN); encoder->gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN);
if (IS_ERR(encoder->gpios)) { if (IS_ERR(encoder->gpios))
err = PTR_ERR(encoder->gpios); return dev_err_probe(dev, PTR_ERR(encoder->gpios), "unable to get gpios\n");
if (err != -EPROBE_DEFER)
dev_err(dev, "unable to get gpios: %d\n", err);
return err;
}
if (encoder->gpios->ndescs < 2) { if (encoder->gpios->ndescs < 2) {
dev_err(dev, "not enough gpios found\n"); dev_err(dev, "not enough gpios found\n");
return -EINVAL; return -EINVAL;
......
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