[lvc-project] [PATCH] Input: synaptics - remove unreachable code

Igor Artemiev posted 1 patch 2 years, 11 months ago
drivers/input/mouse/synaptics.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[lvc-project] [PATCH] Input: synaptics - remove unreachable code
Posted by Igor Artemiev 2 years, 11 months ago
The synaptics_resolution() function always returnd 0.
And there is no need to check its result.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: e839ffab0289 ("Input: synaptics - add support for Intertouch devices")
Signed-off-by: Igor Artemiev <Igor.A.Artemiev@mcst.ru>
---
 drivers/input/mouse/synaptics.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index fa021af8506e..4f1182bf9667 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -444,9 +444,7 @@ static int synaptics_query_hardware(struct psmouse *psmouse,
 	if (error)
 		return error;
 
-	error = synaptics_resolution(psmouse, info);
-	if (error)
-		return error;
+	synaptics_resolution(psmouse, info);
 
 	return 0;
 }
-- 
2.30.2
Re: [lvc-project] [PATCH] Input: synaptics - remove unreachable code
Posted by Andi Shyti 2 years, 11 months ago
Hi Igor,

On Tue, Mar 14, 2023 at 03:43:36PM +0300, Igor Artemiev wrote:
> The synaptics_resolution() function always returnd 0.
> And there is no need to check its result.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: e839ffab0289 ("Input: synaptics - add support for Intertouch devices")
> Signed-off-by: Igor Artemiev <Igor.A.Artemiev@mcst.ru>
> ---
>  drivers/input/mouse/synaptics.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index fa021af8506e..4f1182bf9667 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -444,9 +444,7 @@ static int synaptics_query_hardware(struct psmouse *psmouse,
>  	if (error)
>  		return error;
>  
> -	error = synaptics_resolution(psmouse, info);
> -	if (error)
> -		return error;
> +	synaptics_resolution(psmouse, info);

Again, please make "synaptics_resolution()" void. As it is you
are just ignoring a return value, even if you are sure it's '0'.

Andi