Re: [PATCH] Thermal - Fix possible NULL derefrence.

From: Zhang Rui
Date: Mon Feb 06 2017 - 22:30:30 EST


Just one comment,
the subject should beÂ
[PATCH] Thermal: imx_thermal : Fix possible NULL derefrence

On Mon, 2017-01-30 at 10:34 +0530, Shailendra Verma wrote:
> of_device_get_match_data could return NULL, and so can cause
> a NULL pointer dereference later.
>
> Signed-off-by: Shailendra Verma <shailendra.v@xxxxxxxxxxx>

I think Eduardo will take this patch.

thanks,
rui
> ---
> Âdrivers/thermal/imx_thermal.c |ÂÂÂÂ4 ++++
> Â1 file changed, 4 insertions(+)
>
> diff --git a/drivers/thermal/imx_thermal.c
> b/drivers/thermal/imx_thermal.c
> index 06912f0..fb648a4 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) {