Skip to content

Commit

Permalink
Input: silead - 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-19-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 17d981f commit 21142c1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/input/touchscreen/silead.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,11 +706,9 @@ static int silead_ts_probe(struct i2c_client *client)

/* Power GPIO pin */
data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW);
if (IS_ERR(data->gpio_power)) {
if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER)
dev_err(dev, "Shutdown GPIO request failed\n");
return PTR_ERR(data->gpio_power);
}
if (IS_ERR(data->gpio_power))
return dev_err_probe(dev, PTR_ERR(data->gpio_power),
"Shutdown GPIO request failed\n");

error = silead_ts_setup(client);
if (error)
Expand Down

0 comments on commit 21142c1

Please sign in to comment.