Skip to content

Commit

Permalink
thermal: i.MX: Allow thermal probe to fail gracefully in case of bad …
Browse files Browse the repository at this point in the history
…calibration.

Without this fix, the thermal probe on i.MX6 might trigger a division
by zero exception later in the probe if the calibration does fail.

Note: This linux behavior (Division by zero in kernel) has been triggered
on a Qemu i.MX6 emulation where parameters in nvmem were not set. With this
fix the division by zero is not triggeed anymore as the thermal probe does
fail early.

Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
  • Loading branch information
Jean-Christophe Dubois authored and Eduardo Valentin committed Jul 2, 2018
1 parent 021c917 commit be926ce
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/thermal/imx_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,10 @@ static int imx_init_from_nvmem_cells(struct platform_device *pdev)
ret = nvmem_cell_read_u32(&pdev->dev, "calib", &val);
if (ret)
return ret;
imx_init_calib(pdev, val);

ret = imx_init_calib(pdev, val);
if (ret)
return ret;

ret = nvmem_cell_read_u32(&pdev->dev, "temp_grade", &val);
if (ret)
Expand Down

0 comments on commit be926ce

Please sign in to comment.