mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 06:33:34 +00:00
thermal: qoriq: Use devm_platform_ioremap_resource() instead of of_iomap()
Use devm_platform_ioremap_resource() instead of of_iomap() to save the iounmap() call in error handle path; Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
This commit is contained in:
parent
11f0cdc8bd
commit
4d82000af0
@ -204,11 +204,10 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
data->little_endian = of_property_read_bool(np, "little-endian");
|
data->little_endian = of_property_read_bool(np, "little-endian");
|
||||||
|
|
||||||
data->regs = of_iomap(np, 0);
|
data->regs = devm_platform_ioremap_resource(pdev, 0);
|
||||||
if (!data->regs) {
|
if (IS_ERR(data->regs)) {
|
||||||
dev_err(&pdev->dev, "Failed to get memory region\n");
|
dev_err(&pdev->dev, "Failed to get memory region\n");
|
||||||
ret = -ENODEV;
|
return PTR_ERR(data->regs);
|
||||||
goto err_iomap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data->clk = devm_clk_get_optional(&pdev->dev, NULL);
|
data->clk = devm_clk_get_optional(&pdev->dev, NULL);
|
||||||
@ -225,22 +224,19 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
ret = qoriq_tmu_calibration(pdev); /* TMU calibration */
|
ret = qoriq_tmu_calibration(pdev); /* TMU calibration */
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err_tmu;
|
goto err;
|
||||||
|
|
||||||
ret = qoriq_tmu_register_tmu_zone(pdev);
|
ret = qoriq_tmu_register_tmu_zone(pdev);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&pdev->dev, "Failed to register sensors\n");
|
dev_err(&pdev->dev, "Failed to register sensors\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto err_tmu;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_tmu:
|
err:
|
||||||
clk_disable_unprepare(data->clk);
|
clk_disable_unprepare(data->clk);
|
||||||
iounmap(data->regs);
|
|
||||||
|
|
||||||
err_iomap:
|
|
||||||
platform_set_drvdata(pdev, NULL);
|
platform_set_drvdata(pdev, NULL);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -253,8 +249,6 @@ static int qoriq_tmu_remove(struct platform_device *pdev)
|
|||||||
/* Disable monitoring */
|
/* Disable monitoring */
|
||||||
tmu_write(data, TMR_DISABLE, &data->regs->tmr);
|
tmu_write(data, TMR_DISABLE, &data->regs->tmr);
|
||||||
|
|
||||||
iounmap(data->regs);
|
|
||||||
|
|
||||||
clk_disable_unprepare(data->clk);
|
clk_disable_unprepare(data->clk);
|
||||||
|
|
||||||
platform_set_drvdata(pdev, NULL);
|
platform_set_drvdata(pdev, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user