Skip to contentSkip to conversation

Input: pxa27x_keypad - remove an unneeded NULL check

PATCH Applied Dan Carpenter 2 participants 2 messages Feb 11, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: pxa27x_keypad - remove an unneeded NULL check

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.

drivers/input/keyboard/pxa27x_keypad.c +1 -1
index a89488a..385abf8 100644
@@ -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;
maintainer Applied
#1 lore raw
Quoted 5 lines · Dan Carpenter

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.

Applied in a modified form - removed the temp altogether.

drivers/input/keyboard/pxa27x_keypad.c static int pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) · line 352

Quoted 13 lines
drivers/input/keyboard/pxa27x_keypad.c +1 -0
index a89488a..385abf8 100644
@@ -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.

Signature · 1 line
Dmitry