From: Shailendra Verma Date: Mon, 30 Jan 2017 05:04:58 +0000 (+0530) Subject: thermal: imx: Fix possible NULL dereference. X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8b051ec37c93b28e1f1cac4c9677ff88e56930ff;p=linux.git 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 Signed-off-by: Eduardo Valentin --- diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 06912f0602b75..fb648a45754ee 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) data->tempmon = map; data->socdata = of_device_get_match_data(&pdev->dev); + if (!data->socdata) { + dev_err(&pdev->dev, "no device match found\n"); + return -ENODEV; + } /* make sure the IRQ flag is clear before enabling irq on i.MX6SX */ if (data->socdata->version == TEMPMON_IMX6SX) {