diff mbox

Input: pxa27x_keypad - remove an unneeded NULL check

Message ID 20150211102802.GD18515@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Feb. 11, 2015, 10:28 a.m. UTC
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>

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Dmitry Torokhov Feb. 11, 2015, 5:36 p.m. UTC | #1
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.
diff mbox

Patch

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;