[RFC 15/42] drivers/mtd/maps: don't check resource with devm_ioremap_resource

From: Wolfram Sang
Date: Fri May 10 2013 - 04:16:58 EST


devm_ioremap_resource does sanity checks on the given resource. No need to
duplicate this in the driver.

Signed-off-by: Wolfram Sang <wsa@xxxxxxxxxxxxx>
---
drivers/mtd/maps/autcpu12-nvram.c | 7 +------
drivers/mtd/maps/lantiq-flash.c | 8 +-------
2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/mtd/maps/autcpu12-nvram.c b/drivers/mtd/maps/autcpu12-nvram.c
index c3525d2..58853b0 100644
--- a/drivers/mtd/maps/autcpu12-nvram.c
+++ b/drivers/mtd/maps/autcpu12-nvram.c
@@ -47,15 +47,10 @@ static int autcpu12_nvram_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, priv);

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "failed to get memory resource\n");
- return -ENOENT;
- }
-
priv->map.bankwidth = 4;
priv->map.phys = res->start;
priv->map.size = resource_size(res);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->map.virt = devm_ioremap_resource(&pdev->dev, res);
strcpy((char *)priv->map.name, res->name);
if (IS_ERR(priv->map.virt))
diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
index d1da6ed..f405c34 100644
--- a/drivers/mtd/maps/lantiq-flash.c
+++ b/drivers/mtd/maps/lantiq-flash.c
@@ -127,16 +127,10 @@ ltq_mtd_probe(struct platform_device *pdev)
ltq_mtd = kzalloc(sizeof(struct ltq_mtd), GFP_KERNEL);
platform_set_drvdata(pdev, ltq_mtd);

- ltq_mtd->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!ltq_mtd->res) {
- dev_err(&pdev->dev, "failed to get memory resource\n");
- err = -ENOENT;
- goto err_out;
- }
-
ltq_mtd->map = kzalloc(sizeof(struct map_info), GFP_KERNEL);
ltq_mtd->map->phys = ltq_mtd->res->start;
ltq_mtd->map->size = resource_size(ltq_mtd->res);
+ ltq_mtd->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res);
if (IS_ERR(ltq_mtd->map->virt)) {
err = PTR_ERR(ltq_mtd->map->virt);
--
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/