Skip to content

Commit

Permalink
Thermal: don't check resource with devm_ioremap_resource
Browse files Browse the repository at this point in the history
devm_ioremap_resource does sanity checks on the given resource.
No need to duplicate this in the driver.

CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
CC: Vincenzo Frascino <vincenzo.frascino@st.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
  • Loading branch information
Zhang Rui committed May 28, 2013
1 parent 253e3ae commit c21bec8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
10 changes: 0 additions & 10 deletions drivers/thermal/armada_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,11 @@ static int armada_thermal_probe(struct platform_device *pdev)
return -ENOMEM;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "Failed to get platform resource\n");
return -ENODEV;
}

priv->sensor = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->sensor))
return PTR_ERR(priv->sensor);

res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (!res) {
dev_err(&pdev->dev, "Failed to get platform resource\n");
return -ENODEV;
}

priv->control = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->control))
return PTR_ERR(priv->control);
Expand Down
13 changes: 3 additions & 10 deletions drivers/thermal/spear_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,11 @@ static int spear_thermal_probe(struct platform_device *pdev)
return -ENOMEM;
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "memory resource missing\n");
return -ENODEV;
}

/* Enable thermal sensor */
stdev->thermal_base = devm_ioremap_resource(dev, res);
if (IS_ERR(stdev->thermal_base)) {
dev_err(&pdev->dev, "ioremap failed\n");
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
stdev->thermal_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(stdev->thermal_base))
return PTR_ERR(stdev->thermal_base);
}

stdev->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(stdev->clk)) {
Expand Down

0 comments on commit c21bec8

Please sign in to comment.