All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] input: pm8xxx-vibrator: fix a potential NULL pointer dereference
@ 2019-03-09  5:39 Kangjie Lu
  2019-04-27  0:27 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Kangjie Lu @ 2019-03-09  5:39 UTC (permalink / raw)
  To: kjlu; +Cc: pakki001, Dmitry Torokhov, linux-input, linux-kernel

In case of_device_get_match_data fails to find the matched data,
returns -ENODEV

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/input/misc/pm8xxx-vibrator.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c
index 7dd1c1fbe42a..740e59c11808 100644
--- a/drivers/input/misc/pm8xxx-vibrator.c
+++ b/drivers/input/misc/pm8xxx-vibrator.c
@@ -196,6 +196,8 @@ static int pm8xxx_vib_probe(struct platform_device *pdev)
 	vib->vib_input_dev = input_dev;
 
 	regs = of_device_get_match_data(&pdev->dev);
+	if (unlikely(!regs))
+		return -ENODEV;
 
 	/* operate in manual mode */
 	error = regmap_read(vib->regmap, regs->drv_addr, &val);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] input: pm8xxx-vibrator: fix a potential NULL pointer dereference
@ 2019-03-23  2:44 Kangjie Lu
  0 siblings, 0 replies; 3+ messages in thread
From: Kangjie Lu @ 2019-03-23  2:44 UTC (permalink / raw)
  To: kjlu; +Cc: pakki001, Dmitry Torokhov, linux-input, linux-kernel

In case of_device_get_match_data fails to find the matched data,
returns -ENODEV

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/input/misc/pm8xxx-vibrator.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c
index 7dd1c1fbe42a..740e59c11808 100644
--- a/drivers/input/misc/pm8xxx-vibrator.c
+++ b/drivers/input/misc/pm8xxx-vibrator.c
@@ -196,6 +196,8 @@ static int pm8xxx_vib_probe(struct platform_device *pdev)
 	vib->vib_input_dev = input_dev;
 
 	regs = of_device_get_match_data(&pdev->dev);
+	if (unlikely(!regs))
+		return -ENODEV;
 
 	/* operate in manual mode */
 	error = regmap_read(vib->regmap, regs->drv_addr, &val);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-27  0:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09  5:39 [PATCH] input: pm8xxx-vibrator: fix a potential NULL pointer dereference Kangjie Lu
2019-04-27  0:27 ` Dmitry Torokhov
2019-03-23  2:44 Kangjie Lu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.