提交 06303c2e 编写于 作者: T Thierry Reding 提交者: Greg Kroah-Hartman

memory: Convert to devm_ioremap_resource()

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() 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: NThierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 8d1cbc98
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/err.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/platform_data/emif_plat.h> #include <linux/platform_data/emif_plat.h>
...@@ -1468,12 +1469,9 @@ static int __init_or_module emif_probe(struct platform_device *pdev) ...@@ -1468,12 +1469,9 @@ static int __init_or_module emif_probe(struct platform_device *pdev)
goto error; goto error;
} }
emif->base = devm_request_and_ioremap(emif->dev, res); emif->base = devm_ioremap_resource(emif->dev, res);
if (!emif->base) { if (IS_ERR(emif->base))
dev_err(emif->dev, "%s: devm_request_and_ioremap() failed\n",
__func__);
goto error; goto error;
}
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <linux/err.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
...@@ -216,9 +217,9 @@ static int tegra20_mc_probe(struct platform_device *pdev) ...@@ -216,9 +217,9 @@ static int tegra20_mc_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, i); res = platform_get_resource(pdev, IORESOURCE_MEM, i);
if (!res) if (!res)
return -ENODEV; return -ENODEV;
mc->regs[i] = devm_request_and_ioremap(&pdev->dev, res); mc->regs[i] = devm_ioremap_resource(&pdev->dev, res);
if (!mc->regs[i]) if (IS_ERR(mc->regs[i]))
return -EBUSY; return PTR_ERR(mc->regs[i]);
} }
irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <linux/err.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
...@@ -336,9 +337,9 @@ static int tegra30_mc_probe(struct platform_device *pdev) ...@@ -336,9 +337,9 @@ static int tegra30_mc_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, i); res = platform_get_resource(pdev, IORESOURCE_MEM, i);
if (!res) if (!res)
return -ENODEV; return -ENODEV;
mc->regs[i] = devm_request_and_ioremap(&pdev->dev, res); mc->regs[i] = devm_ioremap_resource(&pdev->dev, res);
if (!mc->regs[i]) if (IS_ERR(mc->regs[i]))
return -EBUSY; return PTR_ERR(mc->regs[i]);
} }
irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册