linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] Input: pxa27x_keypad - remove an unneeded NULL check
@ 2015-02-11 10:28 Dan Carpenter
  2015-02-11 17:36 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-02-11 10:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Chao Xie
  Cc: Rob Herring, Wolfram Sang, Pramod Gurav, linux-input,
	kernel-janitors

Static checkers complain about this NULL check because we dereference it
without checking a couple lines later.  This function is only called
when "keypad->pdata" is non-NULL so we can just delete the NULL test.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index a89488a..385abf8 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -346,7 +346,7 @@ static int pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
 	const struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
 	struct input_dev *input_dev = keypad->input_dev;
 	const struct matrix_keymap_data *keymap_data =
-				pdata ? pdata->matrix_keymap_data : NULL;
+						pdata->matrix_keymap_data;
 	unsigned short keycode;
 	int i;
 	int error;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] Input: pxa27x_keypad - remove an unneeded NULL check
  2015-02-11 10:28 [patch] Input: pxa27x_keypad - remove an unneeded NULL check Dan Carpenter
@ 2015-02-11 17:36 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2015-02-11 17:36 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Chao Xie, Rob Herring, Wolfram Sang, Pramod Gurav, linux-input,
	kernel-janitors

On Wed, Feb 11, 2015 at 01:28:02PM +0300, Dan Carpenter wrote:
> Static checkers complain about this NULL check because we dereference it
> without checking a couple lines later.  This function is only called
> when "keypad->pdata" is non-NULL so we can just delete the NULL test.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied in a modified form - removed the temp altogether.

> 
> diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
> index a89488a..385abf8 100644
> --- a/drivers/input/keyboard/pxa27x_keypad.c
> +++ b/drivers/input/keyboard/pxa27x_keypad.c
> @@ -346,7 +346,7 @@ static int pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
>  	const struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
>  	struct input_dev *input_dev = keypad->input_dev;
>  	const struct matrix_keymap_data *keymap_data =
> -				pdata ? pdata->matrix_keymap_data : NULL;
> +						pdata->matrix_keymap_data;
>  	unsigned short keycode;
>  	int i;
>  	int error;

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-11 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-11 10:28 [patch] Input: pxa27x_keypad - remove an unneeded NULL check Dan Carpenter
2015-02-11 17:36 ` Dmitry Torokhov

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).