Commit 337ac36c authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Dmitry Torokhov

Input: sx8643 - 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-22-krzysztof.kozlowski@linaro.orgSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent d08149c1
......@@ -323,13 +323,9 @@ static int sx8654_probe(struct i2c_client *client)
sx8654->gpio_reset = devm_gpiod_get_optional(&client->dev, "reset",
GPIOD_OUT_HIGH);
if (IS_ERR(sx8654->gpio_reset)) {
error = PTR_ERR(sx8654->gpio_reset);
if (error != -EPROBE_DEFER)
dev_err(&client->dev, "unable to get reset-gpio: %d\n",
error);
return error;
}
if (IS_ERR(sx8654->gpio_reset))
return dev_err_probe(&client->dev, PTR_ERR(sx8654->gpio_reset),
"unable to get reset-gpio\n");
dev_dbg(&client->dev, "got GPIO reset pin\n");
sx8654->data = device_get_match_data(&client->dev);
......
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