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: Thierry Reding <[email protected]> Cc: David S. Miller <[email protected]> Cc: [email protected] --- drivers/net/can/grcan.c | 8 ++++---- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c index 17fbc7a..4c3a7dd 100644 --- a/drivers/net/can/grcan.c +++ b/drivers/net/can/grcan.c @@ -26,6 +26,7 @@ * Contributors: Andreas Larsson <[email protected]> */ +#include <linux/err.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/interrupt.h> @@ -1683,10 +1684,9 @@ static int grcan_probe(struct platform_device *ofdev) } res = platform_get_resource(ofdev, IORESOURCE_MEM, 0); - base = devm_request_and_ioremap(&ofdev->dev, res); - if (!base) { - dev_err(&ofdev->dev, "couldn't map IO resource\n"); - err = -EADDRNOTAVAIL; + base = devm_ioremap_resource(&ofdev->dev, res); + if (IS_ERR(base)) { + err = PTR_ERR(base); goto exit_error; } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index b43d68b..a3431aa 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -22,6 +22,7 @@ Author: Giuseppe Cavallaro <[email protected]> *******************************************************************************/ +#include <linux/err.h> #include <linux/platform_device.h> #include <linux/io.h> #include <linux/of.h> @@ -88,11 +89,9 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) if (!res) return -ENODEV; - addr = devm_request_and_ioremap(dev, res); - if (!addr) { - pr_err("%s: ERROR: memory mapping failed", __func__); - return -ENOMEM; - } + addr = devm_ioremap_resource(dev, res); + if (IS_ERR(addr)) + return PTR_ERR(addr); if (pdev->dev.of_node) { plat_dat = devm_kzalloc(&pdev->dev, -- 1.8.1.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

