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>
This commit is contained in:
Shailendra Verma 2017-01-30 10:34:58 +05:30 committed by Eduardo Valentin
parent ef9b36d910
commit 8b051ec37c
1 changed files with 4 additions and 0 deletions

View File

@ -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) {