lkml.org 
[lkml]   [2019]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] input: pm8xxx-vibrator: fix a potential NULL pointer dereference
Date
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
\
 
 \ /
  Last update: 2019-03-09 06:41    [W:0.042 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site