diff mbox

Input: twl4030_keypad - fix potential NULL dereference in twl4030_kp_probe()

Message ID 1301670483.6013.4.camel@phoenix (mailing list archive)
State Accepted
Commit c68b2081250a87ba9b9a173faa5a600cc684602e
Headers show

Commit Message

axel lin April 1, 2011, 3:08 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index 09bef79..d02811c 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -332,7 +332,7 @@  static int __devinit twl4030_kp_program(struct twl4030_keypad *kp)
 static int __devinit twl4030_kp_probe(struct platform_device *pdev)
 {
 	struct twl4030_keypad_data *pdata = pdev->dev.platform_data;
-	const struct matrix_keymap_data *keymap_data = pdata->keymap_data;
+	const struct matrix_keymap_data *keymap_data;
 	struct twl4030_keypad *kp;
 	struct input_dev *input;
 	u8 reg;
@@ -344,6 +344,8 @@  static int __devinit twl4030_kp_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	keymap_data = pdata->keymap_data;
+
 	kp = kzalloc(sizeof(*kp), GFP_KERNEL);
 	input = input_allocate_device();
 	if (!kp || !input) {