twl4030: fix potential null pointer dereference
authorFelipe Balbi <felipe.balbi@nokia.com>
Tue, 30 Sep 2008 18:42:45 +0000 (21:42 +0300)
committerTony Lindgren <tony@atomide.com>
Wed, 1 Oct 2008 10:37:35 +0000 (13:37 +0300)
The following patch fix a potential null pointer
dereference in twl4030 keypad driver when parts
of keypad platform_data aren't passed down to the
driver. At that point kp->dbg_dev is not set yet.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/input/keyboard/omap-twl4030keypad.c

index 3893d63..48f29d3 100644 (file)
@@ -238,7 +238,7 @@ static int __init omap_kp_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        if (!pdata->rows || !pdata->cols || !pdata->keymap) {
-               dev_err(kp->dbg_dev, "No rows, cols or keymap from pdata\n");
+               dev_err(&pdev->dev, "No rows, cols or keymap from pdata\n");
                kfree(kp);
                return -EINVAL;
        }