Skip to content

Commit

Permalink
Input: sx8643 - simplify with dev_err_probe()
Browse files Browse the repository at this point in the history
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>
Link: https://lore.kernel.org/r/20230625162817.100397-22-krzysztof.kozlowski@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Krzysztof Kozlowski authored and Dmitry Torokhov committed Jul 7, 2023
1 parent d08149c commit 337ac36
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions drivers/input/touchscreen/sx8654.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 337ac36

Please sign in to comment.