[PATCH] input: keypad: fix null pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There was a potential NULL pointer dereference if we don't pass
some fields of omap_kp_platform_data.

At the point of the error message, kp->dbg_dev is not set so it
would generate a NULL pointer dereference right away.

Fix it by using &pdev->dev

Signed-of-by: Felipe Balbi <felipe.balbi@xxxxxxxxx>
---

diff --git a/drivers/input/keyboard/omap-twl4030keypad.c b/drivers/input/keyboard/omap-twl4030keypad.c
index 3893d63..48f29d3 100644
--- a/drivers/input/keyboard/omap-twl4030keypad.c
+++ b/drivers/input/keyboard/omap-twl4030keypad.c
@@ -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;
        }


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

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux