aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2013-08-14 05:11:08 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2013-08-30 16:36:15 -0400
commit7a96541a8e9fe720bec3900679ca514fefd2d516 (patch)
tree83e11bb230017741fa7a0541bd2f2e17d05f299a /drivers/mtd
parent39de86ef0d333b210d27edad828d4f7cf68feff3 (diff)
mtd: simplify use of devm_ioremap_resource
Remove unneeded error handling on the result of a call to platform_get_resource when the value is passed to devm_ioremap_resource. Move the call to platform_get_resource adjacent to the call to devm_ioremap_resource to make the connection between them more clear. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression pdev,res,n,e,e1; expression ret != 0; identifier l; @@ - res = platform_get_resource(pdev, IORESOURCE_MEM, n); ... when != res - if (res == NULL) { ... \(goto l;\|return ret;\) } ... when != res + res = platform_get_resource(pdev, IORESOURCE_MEM, n); e = devm_ioremap_resource(e1, res); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/devices/elm.c5
-rw-r--r--drivers/mtd/nand/txx9ndfmc.c4
2 files changed, 1 insertions, 8 deletions
diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
index 4f683d24de5a..d1dd6a33a050 100644
--- a/drivers/mtd/devices/elm.c
+++ b/drivers/mtd/devices/elm.c
@@ -368,11 +368,6 @@ static int elm_probe(struct platform_device *pdev)
368 } 368 }
369 369
370 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 370 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
371 if (!res) {
372 dev_err(&pdev->dev, "no memory resource defined\n");
373 return -ENODEV;
374 }
375
376 info->elm_base = devm_ioremap_resource(&pdev->dev, res); 371 info->elm_base = devm_ioremap_resource(&pdev->dev, res);
377 if (IS_ERR(info->elm_base)) 372 if (IS_ERR(info->elm_base))
378 return PTR_ERR(info->elm_base); 373 return PTR_ERR(info->elm_base);
diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c
index 440b5701cb8e..235714a421dd 100644
--- a/drivers/mtd/nand/txx9ndfmc.c
+++ b/drivers/mtd/nand/txx9ndfmc.c
@@ -281,12 +281,10 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
281 unsigned long gbusclk = plat->gbus_clock; 281 unsigned long gbusclk = plat->gbus_clock;
282 struct resource *res; 282 struct resource *res;
283 283
284 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
285 if (!res)
286 return -ENODEV;
287 drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL); 284 drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL);
288 if (!drvdata) 285 if (!drvdata)
289 return -ENOMEM; 286 return -ENOMEM;
287 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
290 drvdata->base = devm_ioremap_resource(&dev->dev, res); 288 drvdata->base = devm_ioremap_resource(&dev->dev, res);
291 if (IS_ERR(drvdata->base)) 289 if (IS_ERR(drvdata->base))
292 return PTR_ERR(drvdata->base); 290 return PTR_ERR(drvdata->base);