From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: [PATCH v1 2/2] Input: wdt87xx_i2c - switch to use dev_err_probe()
Date: Fri, 21 Mar 2025 20:39:18 +0200 [thread overview]
Message-ID: <20250321183957.455518-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20250321183957.455518-1-andriy.shevchenko@linux.intel.com>
Switch to use dev_err_probe() to simplify the error path and
unify a message template.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/input/touchscreen/wdt87xx_i2c.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c
index 99636d6eb0f3..3e7fbc4d7549 100644
--- a/drivers/input/touchscreen/wdt87xx_i2c.c
+++ b/drivers/input/touchscreen/wdt87xx_i2c.c
@@ -1033,10 +1033,8 @@ static int wdt87xx_ts_create_input_device(struct wdt87xx_data *wdt)
int error;
input = devm_input_allocate_device(dev);
- if (!input) {
- dev_err(dev, "failed to allocate input device\n");
- return -ENOMEM;
- }
+ if (!input)
+ return dev_err_probe(dev, -ENOMEM, "failed to allocate input device\n");
wdt->input = input;
input->name = "WDT87xx Touchscreen";
@@ -1060,16 +1058,15 @@ static int wdt87xx_ts_create_input_device(struct wdt87xx_data *wdt)
INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
error = input_register_device(input);
- if (error) {
- dev_err(dev, "failed to register input device: %d\n", error);
- return error;
- }
+ if (error)
+ return dev_err_probe(dev, error, "failed to register input device\n");
return 0;
}
static int wdt87xx_ts_probe(struct i2c_client *client)
{
+ struct device *dev = &client->dev;
struct wdt87xx_data *wdt;
int error;
@@ -1103,10 +1100,8 @@ static int wdt87xx_ts_probe(struct i2c_client *client)
NULL, wdt87xx_ts_interrupt,
IRQF_ONESHOT,
client->name, wdt);
- if (error) {
- dev_err(&client->dev, "request irq failed: %d\n", error);
- return error;
- }
+ if (error)
+ return dev_err_probe(dev, error, "request irq failed\n");
return 0;
}
--
2.47.2
next prev parent reply other threads:[~2025-03-21 18:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 18:39 [PATCH v1 0/2] Input: wdt87xx_i2c - a couple of cleanups Andy Shevchenko
2025-03-21 18:39 ` [PATCH v1 1/2] Input: wdt87xx_i2c - tidy up ACPI ID table Andy Shevchenko
2025-03-21 18:39 ` Andy Shevchenko [this message]
2025-08-25 13:55 ` [PATCH v1 0/2] Input: wdt87xx_i2c - a couple of cleanups Andy Shevchenko
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=20250321183957.455518-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.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).