Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f6b0889 authored by Axel Lin's avatar Axel Lin Committed by Zhang Rui
Browse files

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: default avatarAxel Lin <axel.lin@ingics.com>
Reviewed-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
parent b7cf0053
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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,
	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);