Skip to content

Commit

Permalink
Thermal: dove: Convert to devm_ioremap_resource()
Browse files Browse the repository at this point in the history
Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages; so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
  • Loading branch information
Sachin Kamat authored and Zhang Rui committed Mar 11, 2013
1 parent f0e68fc commit 6bc51b6
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions drivers/thermal/dove_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,18 @@ static int dove_thermal_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;

priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
if (!priv->sensor) {
dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
return -EADDRNOTAVAIL;
}
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_request_and_ioremap(&pdev->dev, res);
if (!priv->control) {
dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
return -EADDRNOTAVAIL;
}
priv->control = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->control))
return PTR_ERR(priv->control);

ret = dove_init_sensor(priv);
if (ret) {
Expand Down

0 comments on commit 6bc51b6

Please sign in to comment.