[PATCH] Input: Remove dev_err_probe() if error is -ENOMEM

Xichao Zhao posted 1 patch 1 month, 1 week ago
drivers/input/misc/qnap-mcu-input.c   | 2 +-
drivers/input/touchscreen/zforce_ts.c | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
[PATCH] Input: Remove dev_err_probe() if error is -ENOMEM
Posted by Xichao Zhao 1 month, 1 week ago
The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
Therefore, remove the useless call to dev_err_probe(), and just
return the value instead.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 drivers/input/misc/qnap-mcu-input.c   | 2 +-
 drivers/input/touchscreen/zforce_ts.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/input/misc/qnap-mcu-input.c b/drivers/input/misc/qnap-mcu-input.c
index 76e62f0816c1..3be899bfc114 100644
--- a/drivers/input/misc/qnap-mcu-input.c
+++ b/drivers/input/misc/qnap-mcu-input.c
@@ -103,7 +103,7 @@ static int qnap_mcu_input_probe(struct platform_device *pdev)
 
 	input = devm_input_allocate_device(dev);
 	if (!input)
-		return dev_err_probe(dev, -ENOMEM, "no memory for input device\n");
+		return -ENOMEM;
 
 	idev->input = input;
 	idev->dev = dev;
diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
index df42fdf36ae3..a360749fa076 100644
--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -747,8 +747,7 @@ static int zforce_probe(struct i2c_client *client)
 
 	input_dev = devm_input_allocate_device(&client->dev);
 	if (!input_dev)
-		return dev_err_probe(&client->dev, -ENOMEM,
-				     "could not allocate input device\n");
+		return -ENOMEM;
 
 	ts->client = client;
 	ts->input = input_dev;
-- 
2.34.1
Re: [PATCH] Input: Remove dev_err_probe() if error is -ENOMEM
Posted by Dmitry Torokhov 1 month, 1 week ago
Hi Xichao,

On Thu, Aug 21, 2025 at 05:47:51PM +0800, Xichao Zhao wrote:
> The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
> Therefore, remove the useless call to dev_err_probe(), and just
> return the value instead.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>  drivers/input/misc/qnap-mcu-input.c   | 2 +-
>  drivers/input/touchscreen/zforce_ts.c | 3 +--

Please split per-driver.

>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/misc/qnap-mcu-input.c b/drivers/input/misc/qnap-mcu-input.c
> index 76e62f0816c1..3be899bfc114 100644
> --- a/drivers/input/misc/qnap-mcu-input.c
> +++ b/drivers/input/misc/qnap-mcu-input.c
> @@ -103,7 +103,7 @@ static int qnap_mcu_input_probe(struct platform_device *pdev)
>  
>  	input = devm_input_allocate_device(dev);
>  	if (!input)
> -		return dev_err_probe(dev, -ENOMEM, "no memory for input device\n");
> +		return -ENOMEM;
>  
>  	idev->input = input;
>  	idev->dev = dev;
> diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
> index df42fdf36ae3..a360749fa076 100644
> --- a/drivers/input/touchscreen/zforce_ts.c
> +++ b/drivers/input/touchscreen/zforce_ts.c
> @@ -747,8 +747,7 @@ static int zforce_probe(struct i2c_client *client)
>  
>  	input_dev = devm_input_allocate_device(&client->dev);
>  	if (!input_dev)
> -		return dev_err_probe(&client->dev, -ENOMEM,
> -				     "could not allocate input device\n");
> +		return -ENOMEM;
>  
>  	ts->client = client;
>  	ts->input = input_dev;

Thanks.

-- 
Dmitry
Re: [PATCH] Input: Remove dev_err_probe() if error is -ENOMEM
Posted by Heiko Stübner 1 month, 1 week ago
Am Donnerstag, 21. August 2025, 11:47:51 Mitteleuropäische Sommerzeit schrieb Xichao Zhao:
> The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
> Therefore, remove the useless call to dev_err_probe(), and just
> return the value instead.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>

Acked-by: Heiko Stuebner <heiko@sntech.de>

Funnily enough, it seems I "messed up" in both drivers - just with a
decade in between :-)


Heiko

> ---
>  drivers/input/misc/qnap-mcu-input.c   | 2 +-
>  drivers/input/touchscreen/zforce_ts.c | 3 +--
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/misc/qnap-mcu-input.c b/drivers/input/misc/qnap-mcu-input.c
> index 76e62f0816c1..3be899bfc114 100644
> --- a/drivers/input/misc/qnap-mcu-input.c
> +++ b/drivers/input/misc/qnap-mcu-input.c
> @@ -103,7 +103,7 @@ static int qnap_mcu_input_probe(struct platform_device *pdev)
>  
>  	input = devm_input_allocate_device(dev);
>  	if (!input)
> -		return dev_err_probe(dev, -ENOMEM, "no memory for input device\n");
> +		return -ENOMEM;
>  
>  	idev->input = input;
>  	idev->dev = dev;
> diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
> index df42fdf36ae3..a360749fa076 100644
> --- a/drivers/input/touchscreen/zforce_ts.c
> +++ b/drivers/input/touchscreen/zforce_ts.c
> @@ -747,8 +747,7 @@ static int zforce_probe(struct i2c_client *client)
>  
>  	input_dev = devm_input_allocate_device(&client->dev);
>  	if (!input_dev)
> -		return dev_err_probe(&client->dev, -ENOMEM,
> -				     "could not allocate input device\n");
> +		return -ENOMEM;
>  
>  	ts->client = client;
>  	ts->input = input_dev;
>