Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1545814 > unrolled thread

[PATCH] input: synaptics-rmi4: remove redundant null check on rmi_dev

Started byColin King <colin.king@canonical.com>
First post2016-12-21 15:50 +0100
Last post2016-12-29 19:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] input: synaptics-rmi4: remove redundant null check on rmi_dev Colin King <colin.king@canonical.com> - 2016-12-21 15:50 +0100
    Re: [PATCH] input: synaptics-rmi4: remove redundant null check on  rmi_dev Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-12-29 19:30 +0100

#1545814 — [PATCH] input: synaptics-rmi4: remove redundant null check on rmi_dev

FromColin King <colin.king@canonical.com>
Date2016-12-21 15:50 +0100
Subject[PATCH] input: synaptics-rmi4: remove redundant null check on rmi_dev
Message-ID<sQQno-4FS-21@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

rmi_dev is currently being dereferenced before it null checked,
however, after deeper inspecting, rmi_dev can never be null,
so just remove this redundant check. Thanks to Dmitry Torokhov for
noticing that we can remove the null check.

Fixes CoverityScan CID 1391218 ("Dereference before null check")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/input/rmi4/rmi_f03.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c
index 8a7ca3e..9a1b099 100644
--- a/drivers/input/rmi4/rmi_f03.c
+++ b/drivers/input/rmi4/rmi_f03.c
@@ -175,9 +175,6 @@ static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits)
 	int i;
 	int error;
 
-	if (!rmi_dev)
-		return -ENODEV;
-
 	if (drvdata->attn_data.data) {
 		/* First grab the data passed by the transport device */
 		if (drvdata->attn_data.size < ob_len) {
-- 
2.10.2

[toc] | [next] | [standalone]


#1548341 — Re: [PATCH] input: synaptics-rmi4: remove redundant null check on rmi_dev

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2016-12-29 19:30 +0100
SubjectRe: [PATCH] input: synaptics-rmi4: remove redundant null check on rmi_dev
Message-ID<sTNCF-1FX-15@gated-at.bofh.it>
In reply to#1545814
On Wed, Dec 21, 2016 at 02:41:04PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> rmi_dev is currently being dereferenced before it null checked,
> however, after deeper inspecting, rmi_dev can never be null,
> so just remove this redundant check. Thanks to Dmitry Torokhov for
> noticing that we can remove the null check.
> 
> Fixes CoverityScan CID 1391218 ("Dereference before null check")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thank you.

> ---
>  drivers/input/rmi4/rmi_f03.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c
> index 8a7ca3e..9a1b099 100644
> --- a/drivers/input/rmi4/rmi_f03.c
> +++ b/drivers/input/rmi4/rmi_f03.c
> @@ -175,9 +175,6 @@ static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits)
>  	int i;
>  	int error;
>  
> -	if (!rmi_dev)
> -		return -ENODEV;
> -
>  	if (drvdata->attn_data.data) {
>  		/* First grab the data passed by the transport device */
>  		if (drvdata->attn_data.size < ob_len) {
> -- 
> 2.10.2
> 

-- 
Dmitry

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web