@@ -323,18 +323,14 @@ static int ps2_gpio_get_props(struct device *dev,
struct ps2_gpio_data *drvdata)
{
drvdata->gpio_data = devm_gpiod_get(dev, "data", GPIOD_IN);
- if (IS_ERR(drvdata->gpio_data)) {
- dev_err(dev, "failed to request data gpio: %ld",
- PTR_ERR(drvdata->gpio_data));
- return PTR_ERR(drvdata->gpio_data);
- }
+ if (IS_ERR(drvdata->gpio_data))
+ return dev_err_probe(dev, PTR_ERR(drvdata->gpio_data),
+ "failed to request data gpio: %ld")
drvdata->gpio_clk = devm_gpiod_get(dev, "clk", GPIOD_IN);
- if (IS_ERR(drvdata->gpio_clk)) {
- dev_err(dev, "failed to request clock gpio: %ld",
- PTR_ERR(drvdata->gpio_clk));
- return PTR_ERR(drvdata->gpio_clk);
- }
+ if (IS_ERR(drvdata->gpio_clk))
+ return dev_err_probe(dev, PTR_ERR(drvdata->gpio_clk),
+ "failed to request clock gpio");
drvdata->write_enable = device_property_read_bool(dev,
"write-enable");
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing <caihuoqing@baidu.com> --- drivers/input/serio/ps2-gpio.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)