diff options
author | Axel Lin <axel.lin@ingics.com> | 2016-09-07 09:24:52 (GMT) |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2016-09-27 06:02:16 (GMT) |
commit | 1f6b0889d0ea03541be03ccfc8d07deadae98283 (patch) | |
tree | 649d9f8bcb146c28778879bbf826c53c3fc18b11 /drivers/thermal/mtk_thermal.c | |
parent | b7cf0053738c5491df532a625321e976eaa93b22 (diff) | |
download | linux-1f6b0889d0ea03541be03ccfc8d07deadae98283.tar.xz |
thermal: mtk_thermal: Check return value of devm_thermal_zone_of_sensor_register
devm_thermal_zone_of_sensor_register can fail, so check it's return value.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal/mtk_thermal.c')
-rw-r--r-- | drivers/thermal/mtk_thermal.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 7b233c7..34169c3 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -584,6 +584,7 @@ static int mtk_thermal_probe(struct platform_device *pdev) struct resource *res; const struct of_device_id *of_id; u64 auxadc_phys_base, apmixed_phys_base; + struct thermal_zone_device *tzdev; mt = devm_kzalloc(&pdev->dev, sizeof(*mt), GFP_KERNEL); if (!mt) @@ -666,11 +667,17 @@ static int mtk_thermal_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mt); - devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt, - &mtk_thermal_ops); + tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt, + &mtk_thermal_ops); + if (IS_ERR(tzdev)) { + ret = PTR_ERR(tzdev); + goto err_disable_clk_peri_therm; + } return 0; +err_disable_clk_peri_therm: + clk_disable_unprepare(mt->clk_peri_therm); err_disable_clk_auxadc: clk_disable_unprepare(mt->clk_auxadc); |