diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2013-08-19 04:51:56 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-10-29 16:23:47 -0400 |
commit | c6e7274e7a04af90b6dd7b507e1ea15dbe37b2e0 (patch) | |
tree | 550fd87ac2d57b142233deb7fbb8cd0ccffe21fe | |
parent | dbee7169742e81e42bcef0bbc6c42b20d4f665f0 (diff) |
MIPS: ath79: simplify platform_get_resource_byname/devm_ioremap_resource
Remove unneeded error handling on the result of a call to
platform_get_resource_byname when the value is passed to devm_ioremap_resource.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression pdev,res,e,e1;
expression ret != 0;
identifier l;
@@
res = platform_get_resource_byname(...);
- if (res == NULL) { ... \(goto l;\|return ret;\) }
e = devm_ioremap_resource(e1, res);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Gabor Juhos <juhosg@openwrt.org>
Cc: kernel-janitors@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/5725/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/pci/pci-ar71xx.c | 3 | ||||
-rw-r--r-- | arch/mips/pci/pci-ar724x.c | 9 |
2 files changed, 0 insertions, 12 deletions
diff --git a/arch/mips/pci/pci-ar71xx.c b/arch/mips/pci/pci-ar71xx.c index 18517dd0f709..d471a26dd5f8 100644 --- a/arch/mips/pci/pci-ar71xx.c +++ b/arch/mips/pci/pci-ar71xx.c | |||
@@ -363,9 +363,6 @@ static int ar71xx_pci_probe(struct platform_device *pdev) | |||
363 | spin_lock_init(&apc->lock); | 363 | spin_lock_init(&apc->lock); |
364 | 364 | ||
365 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base"); | 365 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base"); |
366 | if (!res) | ||
367 | return -EINVAL; | ||
368 | |||
369 | apc->cfg_base = devm_ioremap_resource(&pdev->dev, res); | 366 | apc->cfg_base = devm_ioremap_resource(&pdev->dev, res); |
370 | if (IS_ERR(apc->cfg_base)) | 367 | if (IS_ERR(apc->cfg_base)) |
371 | return PTR_ERR(apc->cfg_base); | 368 | return PTR_ERR(apc->cfg_base); |
diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c index 65ec032fa0b4..785b2659b519 100644 --- a/arch/mips/pci/pci-ar724x.c +++ b/arch/mips/pci/pci-ar724x.c | |||
@@ -362,25 +362,16 @@ static int ar724x_pci_probe(struct platform_device *pdev) | |||
362 | return -ENOMEM; | 362 | return -ENOMEM; |
363 | 363 | ||
364 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl_base"); | 364 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl_base"); |
365 | if (!res) | ||
366 | return -EINVAL; | ||
367 | |||
368 | apc->ctrl_base = devm_ioremap_resource(&pdev->dev, res); | 365 | apc->ctrl_base = devm_ioremap_resource(&pdev->dev, res); |
369 | if (IS_ERR(apc->ctrl_base)) | 366 | if (IS_ERR(apc->ctrl_base)) |
370 | return PTR_ERR(apc->ctrl_base); | 367 | return PTR_ERR(apc->ctrl_base); |
371 | 368 | ||
372 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base"); | 369 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base"); |
373 | if (!res) | ||
374 | return -EINVAL; | ||
375 | |||
376 | apc->devcfg_base = devm_ioremap_resource(&pdev->dev, res); | 370 | apc->devcfg_base = devm_ioremap_resource(&pdev->dev, res); |
377 | if (IS_ERR(apc->devcfg_base)) | 371 | if (IS_ERR(apc->devcfg_base)) |
378 | return PTR_ERR(apc->devcfg_base); | 372 | return PTR_ERR(apc->devcfg_base); |
379 | 373 | ||
380 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "crp_base"); | 374 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "crp_base"); |
381 | if (!res) | ||
382 | return -EINVAL; | ||
383 | |||
384 | apc->crp_base = devm_ioremap_resource(&pdev->dev, res); | 375 | apc->crp_base = devm_ioremap_resource(&pdev->dev, res); |
385 | if (IS_ERR(apc->crp_base)) | 376 | if (IS_ERR(apc->crp_base)) |
386 | return PTR_ERR(apc->crp_base); | 377 | return PTR_ERR(apc->crp_base); |