linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cai Huoqing <caihuoqing@baidu.com>
To: <caihuoqing@baidu.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	<linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] Input: ps2-gpio - Make use of the helper function dev_err_probe()
Date: Thu, 16 Sep 2021 23:33:03 +0800	[thread overview]
Message-ID: <20210916153304.14575-1-caihuoqing@baidu.com> (raw)

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(-)

diff --git a/drivers/input/serio/ps2-gpio.c b/drivers/input/serio/ps2-gpio.c
index 8970b49ea09a..d46355f868fd 100644
--- a/drivers/input/serio/ps2-gpio.c
+++ b/drivers/input/serio/ps2-gpio.c
@@ -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");
-- 
2.25.1


                 reply	other threads:[~2021-09-16 15:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210916153304.14575-1-caihuoqing@baidu.com \
    --to=caihuoqing@baidu.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).