Skip to content

Commit

Permalink
Input: w90p910_keypad - move a dereference below a NULL test
Browse files Browse the repository at this point in the history
We should first check whether platform data is NULL or not, before
dereferencing it to get the keymap.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Julia Lawall authored and Dmitry Torokhov committed Aug 30, 2009
1 parent 9d83406 commit 903b912
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/input/keyboard/w90p910_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static int __devinit w90p910_keypad_probe(struct platform_device *pdev)
{
const struct w90p910_keypad_platform_data *pdata =
pdev->dev.platform_data;
const struct matrix_keymap_data *keymap_data = pdata->keymap_data;
const struct matrix_keymap_data *keymap_data;
struct w90p910_keypad *keypad;
struct input_dev *input_dev;
struct resource *res;
Expand All @@ -132,6 +132,8 @@ static int __devinit w90p910_keypad_probe(struct platform_device *pdev)
return -EINVAL;
}

keymap_data = pdata->keymap_data;

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "failed to get keypad irq\n");
Expand Down

0 comments on commit 903b912

Please sign in to comment.