Re: [PATCH v2 2/2] Input: wdt87xx_i2c - switch to use dev_err_probe()

Dmitry Torokhov
2026-01-20T20:40:29Z

Hi Andy,

On Tue, Jan 13, 2026 at 09:22:58AM +0100, Andy Shevchenko wrote:
> Switch to use dev_err_probe() to simplify the error path and
> unify a message template. With that being done, drop the now no-op
> message for -ENOMEM as allocator will print a big warning anyway
> and remove duplicate message for devm_request_threaded_irq().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/input/touchscreen/wdt87xx_i2c.c | 24 +++++++-----------------
> 1 file changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c
> index 99636d6eb0f3..3bf899fe615c 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");
> + if (!input)
> return -ENOMEM;
> - }
> 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;

You introduced a tempo but used it in only one place. I dropped it.

> struct wdt87xx_data *wdt;
> int error;
>
> @@ -1099,16 +1096,9 @@ static int wdt87xx_ts_probe(struct i2c_client *client)
> if (error)
> return error;
>
> - error = devm_request_threaded_irq(&client->dev, client->irq,
> - NULL, wdt87xx_ts_interrupt,
> - IRQF_ONESHOT,
> - client->name, wdt);
> - if (error) {
> - dev_err(&client->dev, "request irq failed: %d\n", error);
> - return error;
> - }
> -
> - return 0;
> + return devm_request_threaded_irq(dev, client->irq,
> + NULL, wdt87xx_ts_interrupt,
> + IRQF_ONESHOT, client->name, wdt);

My preference is to keep "if (error) return error;" even for the last
call when there are multiple potential points of failure in the
function, adjusted.

Applied the updated patch.

Thanks.

--
Dmitry