diff options
author | Shailendra Verma <shailendra.v@samsung.com> | 2017-01-30 00:04:58 -0500 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2017-02-18 20:27:36 -0500 |
commit | 8b051ec37c93b28e1f1cac4c9677ff88e56930ff (patch) | |
tree | 5aba94f1f64819c0b330bc800223bcd699d14b22 /drivers/thermal | |
parent | ef9b36d9101eb2d5827699a4e969c719fb8812c0 (diff) |
thermal: imx: Fix possible NULL dereference.
of_device_get_match_data could return NULL, and so can cause
a NULL pointer dereference later.
Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/imx_thermal.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 06912f0602b7..fb648a45754e 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c | |||
@@ -489,6 +489,10 @@ static int imx_thermal_probe(struct platform_device *pdev) | |||
489 | data->tempmon = map; | 489 | data->tempmon = map; |
490 | 490 | ||
491 | data->socdata = of_device_get_match_data(&pdev->dev); | 491 | data->socdata = of_device_get_match_data(&pdev->dev); |
492 | if (!data->socdata) { | ||
493 | dev_err(&pdev->dev, "no device match found\n"); | ||
494 | return -ENODEV; | ||
495 | } | ||
492 | 496 | ||
493 | /* make sure the IRQ flag is clear before enabling irq on i.MX6SX */ | 497 | /* make sure the IRQ flag is clear before enabling irq on i.MX6SX */ |
494 | if (data->socdata->version == TEMPMON_IMX6SX) { | 498 | if (data->socdata->version == TEMPMON_IMX6SX) { |