* [PATCH 1/29] pinctrl: nomadik: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-15 20:02 ` Linus Walleij
2013-08-14 9:11 ` [PATCH 2/29] video: mxsfb: " Julia Lawall
` (26 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: linux-arm-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/pinctrl/pinctrl-nomadik.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index 89280bc..be126fc 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -1055,10 +1055,6 @@ static int nmk_gpio_probe(struct platform_device *dev)
pdata->num_gpio = NMK_GPIO_PER_CHIP;
}
- res = platform_get_resource(dev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENOENT;
-
irq = platform_get_irq(dev, 0);
if (irq < 0)
return irq;
@@ -1067,6 +1063,7 @@ static int nmk_gpio_probe(struct platform_device *dev)
if (secondary_irq >= 0 && !pdata->get_secondary_status)
return -EINVAL;
+ res = platform_get_resource(dev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(&dev->dev, res);
if (IS_ERR(base))
return PTR_ERR(base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 1/29] pinctrl: nomadik: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 1/29] pinctrl: nomadik: " Julia Lawall
@ 2013-08-15 20:02 ` Linus Walleij
0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2013-08-15 20:02 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Aug 14, 2013 at 11:11 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 2/29] video: mxsfb: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
2013-08-14 9:11 ` [PATCH 1/29] pinctrl: nomadik: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-30 7:51 ` Tomi Valkeinen
2013-08-14 9:11 ` [PATCH 3/29] drivers/gpio: " Julia Lawall
` (25 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard
Cc: kernel-janitors, Tomi Valkeinen, linux-fbdev, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/video/mxsfb.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index c2d3514..d250ed0 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -855,12 +855,6 @@ static int mxsfb_probe(struct platform_device *pdev)
if (of_id)
pdev->id_entry = of_id->data;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "Cannot get memory IO resource\n");
- return -ENODEV;
- }
-
fb_info = framebuffer_alloc(sizeof(struct mxsfb_info), &pdev->dev);
if (!fb_info) {
dev_err(&pdev->dev, "Failed to allocate fbdev\n");
@@ -869,6 +863,7 @@ static int mxsfb_probe(struct platform_device *pdev)
host = to_imxfb_host(fb_info);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
host->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(host->base)) {
ret = PTR_ERR(host->base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 2/29] video: mxsfb: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 2/29] video: mxsfb: " Julia Lawall
@ 2013-08-30 7:51 ` Tomi Valkeinen
0 siblings, 0 replies; 56+ messages in thread
From: Tomi Valkeinen @ 2013-08-30 7:51 UTC (permalink / raw)
To: Julia Lawall
Cc: Jean-Christophe Plagniol-Villard, kernel-janitors, linux-fbdev,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1991 bytes --]
On 14/08/13 12:11, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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>
>
> ---
> drivers/video/mxsfb.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
> index c2d3514..d250ed0 100644
> --- a/drivers/video/mxsfb.c
> +++ b/drivers/video/mxsfb.c
> @@ -855,12 +855,6 @@ static int mxsfb_probe(struct platform_device *pdev)
> if (of_id)
> pdev->id_entry = of_id->data;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res) {
> - dev_err(&pdev->dev, "Cannot get memory IO resource\n");
> - return -ENODEV;
> - }
> -
> fb_info = framebuffer_alloc(sizeof(struct mxsfb_info), &pdev->dev);
> if (!fb_info) {
> dev_err(&pdev->dev, "Failed to allocate fbdev\n");
> @@ -869,6 +863,7 @@ static int mxsfb_probe(struct platform_device *pdev)
>
> host = to_imxfb_host(fb_info);
>
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> host->base = devm_ioremap_resource(&pdev->dev, res);
> if (IS_ERR(host->base)) {
> ret = PTR_ERR(host->base);
>
Thanks, queued for 3.12.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 3/29] drivers/gpio: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
2013-08-14 9:11 ` [PATCH 1/29] pinctrl: nomadik: " Julia Lawall
2013-08-14 9:11 ` [PATCH 2/29] video: mxsfb: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:35 ` Viresh Kumar
2013-08-16 15:17 ` Linus Walleij
2013-08-14 9:11 ` [PATCH 4/29] mtd: " Julia Lawall
` (24 subsequent siblings)
27 siblings, 2 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Linus Walleij; +Cc: kernel-janitors, linux-gpio, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/gpio/gpio-mvebu.c | 7 +------
drivers/gpio/gpio-spear-spics.c | 7 +------
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 80ad35e..3c3321f 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -566,12 +566,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
else
soc_variant = MVEBU_GPIO_SOC_VARIANT_ORION;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "Cannot get memory resource\n");
- return -ENODEV;
- }
-
mvchip = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_gpio_chip), GFP_KERNEL);
if (!mvchip) {
dev_err(&pdev->dev, "Cannot allocate memory\n");
@@ -611,6 +605,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
mvchip->chip.dbg_show = mvebu_gpio_dbg_show;
spin_lock_init(&mvchip->lock);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
mvchip->membase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(mvchip->membase))
return PTR_ERR(mvchip->membase);
diff --git a/drivers/gpio/gpio-spear-spics.c b/drivers/gpio/gpio-spear-spics.c
index 7a4bf7c..e9a0415 100644
--- a/drivers/gpio/gpio-spear-spics.c
+++ b/drivers/gpio/gpio-spear-spics.c
@@ -128,18 +128,13 @@ static int spics_gpio_probe(struct platform_device *pdev)
struct resource *res;
int ret;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "invalid IORESOURCE_MEM\n");
- return -EBUSY;
- }
-
spics = devm_kzalloc(&pdev->dev, sizeof(*spics), GFP_KERNEL);
if (!spics) {
dev_err(&pdev->dev, "memory allocation fail\n");
return -ENOMEM;
}
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
spics->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(spics->base))
return PTR_ERR(spics->base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 3/29] drivers/gpio: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 3/29] drivers/gpio: " Julia Lawall
@ 2013-08-14 9:35 ` Viresh Kumar
2013-08-16 15:17 ` Linus Walleij
1 sibling, 0 replies; 56+ messages in thread
From: Viresh Kumar @ 2013-08-14 9:35 UTC (permalink / raw)
To: Julia Lawall
Cc: Linus Walleij, kernel-janitors, linux-gpio,
linux-kernel@vger.kernel.org, spear-devel
On Wed, Aug 14, 2013 at 2:41 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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>
>
> ---
> drivers/gpio/gpio-spear-spics.c | 7 +------
> 2 files changed, 2 insertions(+), 12 deletions(-)
For SPEAr:
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> diff --git a/drivers/gpio/gpio-spear-spics.c b/drivers/gpio/gpio-spear-spics.c
> index 7a4bf7c..e9a0415 100644
> --- a/drivers/gpio/gpio-spear-spics.c
> +++ b/drivers/gpio/gpio-spear-spics.c
> @@ -128,18 +128,13 @@ static int spics_gpio_probe(struct platform_device *pdev)
> struct resource *res;
> int ret;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res) {
> - dev_err(&pdev->dev, "invalid IORESOURCE_MEM\n");
> - return -EBUSY;
> - }
> -
> spics = devm_kzalloc(&pdev->dev, sizeof(*spics), GFP_KERNEL);
> if (!spics) {
> dev_err(&pdev->dev, "memory allocation fail\n");
> return -ENOMEM;
> }
>
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> spics->base = devm_ioremap_resource(&pdev->dev, res);
> if (IS_ERR(spics->base))
> return PTR_ERR(spics->base);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 3/29] drivers/gpio: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 3/29] drivers/gpio: " Julia Lawall
2013-08-14 9:35 ` Viresh Kumar
@ 2013-08-16 15:17 ` Linus Walleij
1 sibling, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2013-08-16 15:17 UTC (permalink / raw)
To: Julia Lawall
Cc: kernel-janitors, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
On Wed, Aug 14, 2013 at 11:11 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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.
Patch applied with Viresh's ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 4/29] mtd: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (2 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 3/29] drivers/gpio: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-16 14:51 ` Artem Bityutskiy
2013-08-14 9:11 ` [PATCH 5/29] spi/spi-{bcm63xx.c,bfin-v3.c}: " Julia Lawall
` (23 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-mtd, kernel-janitors, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/mtd/devices/elm.c | 5 -----
drivers/mtd/nand/txx9ndfmc.c | 4 +---
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
index 4f683d2..d1dd6a3 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)
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "no memory resource defined\n");
- return -ENODEV;
- }
-
info->elm_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(info->elm_base))
return PTR_ERR(info->elm_base);
diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c
index 440b570..235714a 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)
unsigned long gbusclk = plat->gbus_clock;
struct resource *res;
- res = platform_get_resource(dev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL);
if (!drvdata)
return -ENOMEM;
+ res = platform_get_resource(dev, IORESOURCE_MEM, 0);
drvdata->base = devm_ioremap_resource(&dev->dev, res);
if (IS_ERR(drvdata->base))
return PTR_ERR(drvdata->base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 4/29] mtd: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 4/29] mtd: " Julia Lawall
@ 2013-08-16 14:51 ` Artem Bityutskiy
0 siblings, 0 replies; 56+ messages in thread
From: Artem Bityutskiy @ 2013-08-16 14:51 UTC (permalink / raw)
To: Julia Lawall; +Cc: linux-mtd, kernel-janitors, David Woodhouse, linux-kernel
On Wed, 2013-08-14 at 11:11 +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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.
Pushed to l2-mtd.git, thanks!
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 5/29] spi/spi-{bcm63xx.c,bfin-v3.c}: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (3 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 4/29] mtd: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 16:49 ` Mark Brown
2013-08-14 9:11 ` [PATCH 6/29] tegra: " Julia Lawall
` (22 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Mark Brown; +Cc: kernel-janitors, linux-spi, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/spi/spi-bcm63xx.c | 8 +-------
drivers/spi/spi-bfin-v3.c | 8 +-------
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c
index 4ac028d..2b5c692 100644
--- a/drivers/spi/spi-bcm63xx.c
+++ b/drivers/spi/spi-bcm63xx.c
@@ -342,13 +342,6 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
struct bcm63xx_spi *bs;
int ret;
- r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!r) {
- dev_err(dev, "no iomem\n");
- ret = -ENXIO;
- goto out;
- }
-
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(dev, "no irq\n");
@@ -375,6 +368,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, master);
bs->pdev = pdev;
+ r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
bs->regs = devm_ioremap_resource(&pdev->dev, r);
if (IS_ERR(bs->regs)) {
ret = PTR_ERR(bs->regs);
diff --git a/drivers/spi/spi-bfin-v3.c b/drivers/spi/spi-bfin-v3.c
index 603d7e9..d5bab00 100644
--- a/drivers/spi/spi-bfin-v3.c
+++ b/drivers/spi/spi-bfin-v3.c
@@ -792,13 +792,6 @@ static int bfin_spi_probe(struct platform_device *pdev)
return -ENXIO;
}
- /* get register base and tx/rx dma */
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!mem) {
- dev_err(dev, "can not get register base\n");
- return -ENXIO;
- }
-
res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!res) {
dev_err(dev, "can not get tx dma resource\n");
@@ -838,6 +831,7 @@ static int bfin_spi_probe(struct platform_device *pdev)
drv_data->pin_req = info->pin_req;
drv_data->sclk = sclk;
+ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
drv_data->regs = devm_ioremap_resource(dev, mem);
if (IS_ERR(drv_data->regs)) {
ret = PTR_ERR(drv_data->regs);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 5/29] spi/spi-{bcm63xx.c,bfin-v3.c}: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 5/29] spi/spi-{bcm63xx.c,bfin-v3.c}: " Julia Lawall
@ 2013-08-14 16:49 ` Mark Brown
0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2013-08-14 16:49 UTC (permalink / raw)
To: Julia Lawall; +Cc: kernel-janitors, linux-spi, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 269 bytes --]
On Wed, Aug 14, 2013 at 11:11:09AM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Remove unneeded error handling on the result of a call to
> platform_get_resource when the value is passed to devm_ioremap_resource.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 6/29] tegra: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (4 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 5/29] spi/spi-{bcm63xx.c,bfin-v3.c}: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
[not found] ` <1376471493-22215-7-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
2013-08-14 9:11 ` [PATCH 7/29] dma: mmp: " Julia Lawall
` (21 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Stephen Warren; +Cc: kernel-janitors, linux-tegra, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Remove unneeded error handling on the result of a call to
platform_get_resource 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,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>
---
drivers/iommu/tegra-smmu.c | 2 --
drivers/memory/tegra20-mc.c | 2 --
drivers/memory/tegra30-mc.c | 2 --
3 files changed, 6 deletions(-)
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index f6f120e..e066560 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -1177,8 +1177,6 @@ static int tegra_smmu_probe(struct platform_device *pdev)
struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, i);
- if (!res)
- return -ENODEV;
smmu->regs[i] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(smmu->regs[i]))
return PTR_ERR(smmu->regs[i]);
diff --git a/drivers/memory/tegra20-mc.c b/drivers/memory/tegra20-mc.c
index 0548eea..7cd82b8 100644
--- a/drivers/memory/tegra20-mc.c
+++ b/drivers/memory/tegra20-mc.c
@@ -218,8 +218,6 @@ static int tegra20_mc_probe(struct platform_device *pdev)
struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, i);
- if (!res)
- return -ENODEV;
mc->regs[i] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(mc->regs[i]))
return PTR_ERR(mc->regs[i]);
diff --git a/drivers/memory/tegra30-mc.c b/drivers/memory/tegra30-mc.c
index 58d2979..ef79345 100644
--- a/drivers/memory/tegra30-mc.c
+++ b/drivers/memory/tegra30-mc.c
@@ -340,8 +340,6 @@ static int tegra30_mc_probe(struct platform_device *pdev)
struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, i);
- if (!res)
- return -ENODEV;
mc->regs[i] = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(mc->regs[i]))
return PTR_ERR(mc->regs[i]);
^ permalink raw reply related [flat|nested] 56+ messages in thread* [PATCH 7/29] dma: mmp: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (5 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 6/29] tegra: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:34 ` Vinod Koul
2013-08-14 9:11 ` [PATCH 8/29] drivers/cpuidle/cpuidle-kirkwood.c: " Julia Lawall
` (20 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Vinod Koul; +Cc: kernel-janitors, Dan Williams, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Remove unneeded error handling on the result of a call to
platform_get_resource 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,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>
---
drivers/dma/mmp_pdma.c | 3 ---
drivers/dma/mmp_tdma.c | 3 ---
2 files changed, 6 deletions(-)
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index 9a32f2d..afa5a2e 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -786,9 +786,6 @@ static int mmp_pdma_probe(struct platform_device *op)
spin_lock_init(&pdev->phy_lock);
iores = platform_get_resource(op, IORESOURCE_MEM, 0);
- if (!iores)
- return -EINVAL;
-
pdev->base = devm_ioremap_resource(pdev->dev, iores);
if (IS_ERR(pdev->base))
return PTR_ERR(pdev->base);
diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c
index a9345d0..38cb517 100644
--- a/drivers/dma/mmp_tdma.c
+++ b/drivers/dma/mmp_tdma.c
@@ -550,9 +550,6 @@ static int mmp_tdma_probe(struct platform_device *pdev)
}
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!iores)
- return -EINVAL;
-
tdev->base = devm_ioremap_resource(&pdev->dev, iores);
if (IS_ERR(tdev->base))
return PTR_ERR(tdev->base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 7/29] dma: mmp: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 7/29] dma: mmp: " Julia Lawall
@ 2013-08-14 9:34 ` Vinod Koul
0 siblings, 0 replies; 56+ messages in thread
From: Vinod Koul @ 2013-08-14 9:34 UTC (permalink / raw)
To: Julia Lawall; +Cc: kernel-janitors, Dan Williams, linux-kernel
On Wed, Aug 14, 2013 at 11:11:11AM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Remove unneeded error handling on the result of a call to
> platform_get_resource 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,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>
Applied, thanks
~Vinod
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 8/29] drivers/cpuidle/cpuidle-kirkwood.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (6 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 7/29] dma: mmp: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 12:59 ` Rafael J. Wysocki
2013-08-14 9:11 ` [PATCH 9/29] drivers/char/hw_random/tx4939-rng.c: " Julia Lawall
` (19 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: kernel-janitors, Daniel Lezcano, linux-pm, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Remove unneeded error handling on the result of a call to
platform_get_resource 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,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>
---
drivers/cpuidle/cpuidle-kirkwood.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
index 521b0a7..2237135 100644
--- a/drivers/cpuidle/cpuidle-kirkwood.c
+++ b/drivers/cpuidle/cpuidle-kirkwood.c
@@ -60,9 +60,6 @@ static int kirkwood_cpuidle_probe(struct platform_device *pdev)
struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res = NULL)
- return -EINVAL;
-
ddr_operation_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(ddr_operation_base))
return PTR_ERR(ddr_operation_base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 8/29] drivers/cpuidle/cpuidle-kirkwood.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 8/29] drivers/cpuidle/cpuidle-kirkwood.c: " Julia Lawall
@ 2013-08-14 12:59 ` Rafael J. Wysocki
0 siblings, 0 replies; 56+ messages in thread
From: Rafael J. Wysocki @ 2013-08-14 12:59 UTC (permalink / raw)
To: Julia Lawall; +Cc: kernel-janitors, Daniel Lezcano, linux-pm, linux-kernel
On Wednesday, August 14, 2013 11:11:12 AM Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Remove unneeded error handling on the result of a call to
> platform_get_resource 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,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>
Queued up for 3.12.
Thanks,
Rafael
> ---
> drivers/cpuidle/cpuidle-kirkwood.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
> index 521b0a7..2237135 100644
> --- a/drivers/cpuidle/cpuidle-kirkwood.c
> +++ b/drivers/cpuidle/cpuidle-kirkwood.c
> @@ -60,9 +60,6 @@ static int kirkwood_cpuidle_probe(struct platform_device *pdev)
> struct resource *res;
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (res = NULL)
> - return -EINVAL;
> -
> ddr_operation_base = devm_ioremap_resource(&pdev->dev, res);
> if (IS_ERR(ddr_operation_base))
> return PTR_ERR(ddr_operation_base);
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 9/29] drivers/char/hw_random/tx4939-rng.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (7 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 8/29] drivers/cpuidle/cpuidle-kirkwood.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 10:49 ` Herbert Xu
2013-08-14 9:11 ` [PATCH 10/29] drivers/watchdog/nuc900_wdt.c: " Julia Lawall
` (18 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Matt Mackall; +Cc: kernel-janitors, Herbert Xu, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/char/hw_random/tx4939-rng.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/char/hw_random/tx4939-rng.c b/drivers/char/hw_random/tx4939-rng.c
index 00593c8..09c5fbe 100644
--- a/drivers/char/hw_random/tx4939-rng.c
+++ b/drivers/char/hw_random/tx4939-rng.c
@@ -110,12 +110,10 @@ static int __init tx4939_rng_probe(struct platform_device *dev)
struct resource *r;
int i;
- r = platform_get_resource(dev, IORESOURCE_MEM, 0);
- if (!r)
- return -EBUSY;
rngdev = devm_kzalloc(&dev->dev, sizeof(*rngdev), GFP_KERNEL);
if (!rngdev)
return -ENOMEM;
+ r = platform_get_resource(dev, IORESOURCE_MEM, 0);
rngdev->base = devm_ioremap_resource(&dev->dev, r);
if (IS_ERR(rngdev->base))
return PTR_ERR(rngdev->base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 9/29] drivers/char/hw_random/tx4939-rng.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 9/29] drivers/char/hw_random/tx4939-rng.c: " Julia Lawall
@ 2013-08-14 10:49 ` Herbert Xu
0 siblings, 0 replies; 56+ messages in thread
From: Herbert Xu @ 2013-08-14 10:49 UTC (permalink / raw)
To: Julia Lawall; +Cc: Matt Mackall, kernel-janitors, linux-kernel
On Wed, Aug 14, 2013 at 11:11:13AM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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>
Patch applied. Thanks!
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 10/29] drivers/watchdog/nuc900_wdt.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (8 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 9/29] drivers/char/hw_random/tx4939-rng.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-15 3:17 ` Guenter Roeck
2013-08-14 9:11 ` [PATCH 11/29] marvell-ccic/mmp-driver.c: " Julia Lawall
` (17 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: linux-arm-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Remove unneeded error handling on the result of a call to
platform_get_resource 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,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>
---
drivers/watchdog/nuc900_wdt.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/watchdog/nuc900_wdt.c b/drivers/watchdog/nuc900_wdt.c
index e2b6d2c..b15b6ef 100644
--- a/drivers/watchdog/nuc900_wdt.c
+++ b/drivers/watchdog/nuc900_wdt.c
@@ -256,11 +256,6 @@ static int nuc900wdt_probe(struct platform_device *pdev)
spin_lock_init(&nuc900_wdt->wdt_lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res = NULL) {
- dev_err(&pdev->dev, "no memory resource specified\n");
- return -ENOENT;
- }
-
nuc900_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(nuc900_wdt->wdt_base))
return PTR_ERR(nuc900_wdt->wdt_base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 10/29] drivers/watchdog/nuc900_wdt.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 10/29] drivers/watchdog/nuc900_wdt.c: " Julia Lawall
@ 2013-08-15 3:17 ` Guenter Roeck
2013-08-15 3:29 ` Wan ZongShun
0 siblings, 1 reply; 56+ messages in thread
From: Guenter Roeck @ 2013-08-15 3:17 UTC (permalink / raw)
To: linux-arm-kernel
On 08/14/2013 02:11 AM, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Remove unneeded error handling on the result of a call to
> platform_get_resource 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,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>
>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 10/29] drivers/watchdog/nuc900_wdt.c: simplify use of devm_ioremap_resource
2013-08-15 3:17 ` Guenter Roeck
@ 2013-08-15 3:29 ` Wan ZongShun
0 siblings, 0 replies; 56+ messages in thread
From: Wan ZongShun @ 2013-08-15 3:29 UTC (permalink / raw)
To: linux-arm-kernel
2013/8/15 Guenter Roeck <linux@roeck-us.net>:
> On 08/14/2013 02:11 AM, Julia Lawall wrote:
>>
>> From: Julia Lawall <Julia.Lawall@lip6.fr>
>>
>> Remove unneeded error handling on the result of a call to
>> platform_get_resource 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,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>
>>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Wan Zongshun <mcuos.com@gmail.com>
Thanks for your patch.
>
>
--
Wan ZongShun.
www.mcuos.com
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 11/29] marvell-ccic/mmp-driver.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (9 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 10/29] drivers/watchdog/nuc900_wdt.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:11 ` [PATCH 12/29] sound/soc/samsung/ac97.c: " Julia Lawall
` (16 subsequent siblings)
27 siblings, 0 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Jonathan Corbet
Cc: kernel-janitors, Mauro Carvalho Chehab, linux-media, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Remove unneeded error handling on the result of a call to
platform_get_resource 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,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>
---
drivers/media/platform/marvell-ccic/mmp-driver.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/media/platform/marvell-ccic/mmp-driver.c b/drivers/media/platform/marvell-ccic/mmp-driver.c
index f06daa4..b5a19af 100644
--- a/drivers/media/platform/marvell-ccic/mmp-driver.c
+++ b/drivers/media/platform/marvell-ccic/mmp-driver.c
@@ -396,10 +396,6 @@ static int mmpcam_probe(struct platform_device *pdev)
* Get our I/O memory.
*/
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res = NULL) {
- dev_err(&pdev->dev, "no iomem resource!\n");
- return -ENODEV;
- }
mcam->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(mcam->regs))
return PTR_ERR(mcam->regs);
@@ -409,10 +405,6 @@ static int mmpcam_probe(struct platform_device *pdev)
* should really be managed outside of this driver?
*/
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (res = NULL) {
- dev_err(&pdev->dev, "no power resource!\n");
- return -ENODEV;
- }
cam->power_regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(cam->power_regs))
return PTR_ERR(cam->power_regs);
^ permalink raw reply related [flat|nested] 56+ messages in thread* [PATCH 12/29] sound/soc/samsung/ac97.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (10 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 11/29] marvell-ccic/mmp-driver.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 18:14 ` Mark Brown
2013-08-14 9:11 ` [PATCH 13/29] drivers/input/keyboard/tegra-kbc.c: " Julia Lawall
` (15 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Ben Dooks
Cc: linux-samsung-soc, Kukjin Kim, alsa-devel, Sangbeom Kim,
linux-kernel, kernel-janitors, Liam Girdwood, Takashi Iwai,
Mark Brown, linux-arm-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
sound/soc/samsung/ac97.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index 2dd623f..c732df9 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -404,18 +404,13 @@ static int s3c_ac97_probe(struct platform_device *pdev)
return -ENXIO;
}
- mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!mem_res) {
- dev_err(&pdev->dev, "Unable to get register resource\n");
- return -ENXIO;
- }
-
irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!irq_res) {
dev_err(&pdev->dev, "AC97 IRQ not provided!\n");
return -ENXIO;
}
+ mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
s3c_ac97.regs = devm_ioremap_resource(&pdev->dev, mem_res);
if (IS_ERR(s3c_ac97.regs))
return PTR_ERR(s3c_ac97.regs);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 12/29] sound/soc/samsung/ac97.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 12/29] sound/soc/samsung/ac97.c: " Julia Lawall
@ 2013-08-14 18:14 ` Mark Brown
0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2013-08-14 18:14 UTC (permalink / raw)
To: Julia Lawall
Cc: alsa-devel, Kukjin Kim, Sangbeom Kim, linux-kernel,
kernel-janitors, Liam Girdwood, Takashi Iwai, linux-samsung-soc,
Ben Dooks, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 269 bytes --]
On Wed, Aug 14, 2013 at 11:11:16AM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Remove unneeded error handling on the result of a call to
> platform_get_resource when the value is passed to devm_ioremap_resource.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 13/29] drivers/input/keyboard/tegra-kbc.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (11 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 12/29] sound/soc/samsung/ac97.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:11 ` [PATCH 14/29] drivers/scsi/ufs/ufshcd-pltfrm.c: " Julia Lawall
` (14 subsequent siblings)
27 siblings, 0 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: kernel-janitors, Stephen Warren, linux-input, linux-tegra,
linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/input/keyboard/tegra-kbc.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
index b46142f..9cd20e6 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -638,12 +638,6 @@ static int tegra_kbc_probe(struct platform_device *pdev)
if (!tegra_kbc_check_pin_cfg(kbc, &num_rows))
return -EINVAL;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "failed to get I/O memory\n");
- return -ENXIO;
- }
-
kbc->irq = platform_get_irq(pdev, 0);
if (kbc->irq < 0) {
dev_err(&pdev->dev, "failed to get keyboard IRQ\n");
@@ -658,6 +652,7 @@ static int tegra_kbc_probe(struct platform_device *pdev)
setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
kbc->mmio = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(kbc->mmio))
return PTR_ERR(kbc->mmio);
^ permalink raw reply related [flat|nested] 56+ messages in thread* [PATCH 14/29] drivers/scsi/ufs/ufshcd-pltfrm.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (12 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 13/29] drivers/input/keyboard/tegra-kbc.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:53 ` Santosh Y
2013-08-14 9:11 ` [PATCH 15/29] ASoC: tegra20-ac97: " Julia Lawall
` (13 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Vinayak Holikatti
Cc: kernel-janitors, Santosh Y, James E.J. Bottomley, linux-scsi,
linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Remove unneeded error handling on the result of a call to
platform_get_resource when the value is passed to devm_ioremap_resource.
A debugging statement in the error-handling code is removed as well, as it
doesn't seem to give any more information than devm_ioremap_resource
already gives.
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>
---
drivers/scsi/ufs/ufshcd-pltfrm.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
index c42db40..ea699b9 100644
--- a/drivers/scsi/ufs/ufshcd-pltfrm.c
+++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
@@ -102,15 +102,8 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!mem_res) {
- dev_err(dev, "Memory resource not available\n");
- err = -ENODEV;
- goto out;
- }
-
mmio_base = devm_ioremap_resource(dev, mem_res);
if (IS_ERR(mmio_base)) {
- dev_err(dev, "memory map failed\n");
err = PTR_ERR(mmio_base);
goto out;
}
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 14/29] drivers/scsi/ufs/ufshcd-pltfrm.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 14/29] drivers/scsi/ufs/ufshcd-pltfrm.c: " Julia Lawall
@ 2013-08-14 9:53 ` Santosh Y
0 siblings, 0 replies; 56+ messages in thread
From: Santosh Y @ 2013-08-14 9:53 UTC (permalink / raw)
To: Julia Lawall
Cc: Vinayak Holikatti, kernel-janitors, James E.J. Bottomley,
linux-scsi, open list
On Wed, Aug 14, 2013 at 2:41 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
>
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Remove unneeded error handling on the result of a call to
> platform_get_resource when the value is passed to devm_ioremap_resource.
>
> A debugging statement in the error-handling code is removed as well, as it
> doesn't seem to give any more information than devm_ioremap_resource
> already gives.
>
> 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>
>
> ---
> drivers/scsi/ufs/ufshcd-pltfrm.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
> index c42db40..ea699b9 100644
> --- a/drivers/scsi/ufs/ufshcd-pltfrm.c
> +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
> @@ -102,15 +102,8 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
>
> mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!mem_res) {
> - dev_err(dev, "Memory resource not available\n");
> - err = -ENODEV;
> - goto out;
> - }
> -
> mmio_base = devm_ioremap_resource(dev, mem_res);
> if (IS_ERR(mmio_base)) {
> - dev_err(dev, "memory map failed\n");
> err = PTR_ERR(mmio_base);
> goto out;
> }
>
Redundant error message and error handling have been removed in the
patches submitted by 'Wei Yongjun' and 'Wolfram Sang'.
1. http://www.spinics.net/lists/linux-scsi/msg67557.html
2. http://www.spinics.net/lists/linux-scsi/msg67558.html
thanks anyway... :-)
--
~Santosh
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 15/29] ASoC: tegra20-ac97: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (13 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 14/29] drivers/scsi/ufs/ufshcd-pltfrm.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:11 ` [PATCH 16/29] amba: tegra-ahb: " Julia Lawall
` (12 subsequent siblings)
27 siblings, 0 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Liam Girdwood
Cc: alsa-devel, Stephen Warren, Takashi Iwai, kernel-janitors,
linux-kernel, Mark Brown, linux-tegra
From: Julia Lawall <Julia.Lawall@lip6.fr>
Remove unneeded error handling on the result of a call to
platform_get_resource 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,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>
---
sound/soc/tegra/tegra20_ac97.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c
index 00106b5..ae27bcd 100644
--- a/sound/soc/tegra/tegra20_ac97.c
+++ b/sound/soc/tegra/tegra20_ac97.c
@@ -334,12 +334,6 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
}
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!mem) {
- dev_err(&pdev->dev, "No memory resource\n");
- ret = -ENODEV;
- goto err_clk_put;
- }
-
regs = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(regs)) {
ret = PTR_ERR(regs);
^ permalink raw reply related [flat|nested] 56+ messages in thread* [PATCH 16/29] amba: tegra-ahb: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (14 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 15/29] ASoC: tegra20-ac97: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:11 ` [PATCH 17/29] drivers/rtc: " Julia Lawall
` (11 subsequent siblings)
27 siblings, 0 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Russell King; +Cc: kernel-janitors, Stephen Warren, linux-tegra, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Remove unneeded error handling on the result of a call to
platform_get_resource 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,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>
---
drivers/amba/tegra-ahb.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c
index 1f44e56..558a239 100644
--- a/drivers/amba/tegra-ahb.c
+++ b/drivers/amba/tegra-ahb.c
@@ -256,8 +256,6 @@ static int tegra_ahb_probe(struct platform_device *pdev)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
ahb->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(ahb->regs))
return PTR_ERR(ahb->regs);
^ permalink raw reply related [flat|nested] 56+ messages in thread* [PATCH 17/29] drivers/rtc: simplify use of devm_ioremap_resource
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:28 ` Viresh Kumar
2015-06-06 23:35 ` [17/29] " Alexandre Belloni
0 siblings, 2 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Alessandro Zummo; +Cc: kernel-janitors, rtc-linux, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/rtc/rtc-ds1216.c | 4 +---
drivers/rtc/rtc-ds1286.c | 4 +---
drivers/rtc/rtc-spear.c | 7 +------
3 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/drivers/rtc/rtc-ds1216.c b/drivers/rtc/rtc-ds1216.c
index 9c04fd2..c948bd3 100644
--- a/drivers/rtc/rtc-ds1216.c
+++ b/drivers/rtc/rtc-ds1216.c
@@ -144,15 +144,13 @@ static int __init ds1216_rtc_probe(struct platform_device *pdev)
struct ds1216_priv *priv;
u8 dummy[8];
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
platform_set_drvdata(pdev, priv);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->ioaddr = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->ioaddr))
return PTR_ERR(priv->ioaddr);
diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c
index 50e109b..14c4b24 100644
--- a/drivers/rtc/rtc-ds1286.c
+++ b/drivers/rtc/rtc-ds1286.c
@@ -332,13 +332,11 @@ static int ds1286_probe(struct platform_device *pdev)
struct resource *res;
struct ds1286_priv *priv;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
priv = devm_kzalloc(&pdev->dev, sizeof(struct ds1286_priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->rtcregs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->rtcregs))
return PTR_ERR(priv->rtcregs);
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index c492cf0..6470641 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -358,12 +358,6 @@ static int spear_rtc_probe(struct platform_device *pdev)
int status = 0;
int irq;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "no resource defined\n");
- return -EBUSY;
- }
-
config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL);
if (!config) {
dev_err(&pdev->dev, "out of memory\n");
@@ -385,6 +379,7 @@ static int spear_rtc_probe(struct platform_device *pdev)
return status;
}
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
config->ioaddr = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(config->ioaddr))
return PTR_ERR(config->ioaddr);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 17/29] drivers/rtc: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 17/29] drivers/rtc: " Julia Lawall
@ 2013-08-14 9:28 ` Viresh Kumar
2015-06-06 23:35 ` [17/29] " Alexandre Belloni
1 sibling, 0 replies; 56+ messages in thread
From: Viresh Kumar @ 2013-08-14 9:28 UTC (permalink / raw)
To: Julia Lawall
Cc: Alessandro Zummo, kernel-janitors, rtc-linux,
linux-kernel@vger.kernel.org, spear-devel
On Wed, Aug 14, 2013 at 2:41 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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>
>
> ---
> drivers/rtc/rtc-spear.c | 7 +------
> 3 files changed, 3 insertions(+), 12 deletions(-)
For SPEAr:
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
> index c492cf0..6470641 100644
> --- a/drivers/rtc/rtc-spear.c
> +++ b/drivers/rtc/rtc-spear.c
> @@ -358,12 +358,6 @@ static int spear_rtc_probe(struct platform_device *pdev)
> int status = 0;
> int irq;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res) {
> - dev_err(&pdev->dev, "no resource defined\n");
> - return -EBUSY;
> - }
> -
> config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL);
> if (!config) {
> dev_err(&pdev->dev, "out of memory\n");
> @@ -385,6 +379,7 @@ static int spear_rtc_probe(struct platform_device *pdev)
> return status;
> }
>
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> config->ioaddr = devm_ioremap_resource(&pdev->dev, res);
> if (IS_ERR(config->ioaddr))
> return PTR_ERR(config->ioaddr);
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [17/29] drivers/rtc: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 17/29] drivers/rtc: " Julia Lawall
2013-08-14 9:28 ` Viresh Kumar
@ 2015-06-06 23:35 ` Alexandre Belloni
1 sibling, 0 replies; 56+ messages in thread
From: Alexandre Belloni @ 2015-06-06 23:35 UTC (permalink / raw)
To: Julia Lawall; +Cc: Alessandro Zummo, kernel-janitors, rtc-linux, linux-kernel
On 14/08/2013 at 11:11:21 +0200, Julia Lawall wrote :
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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>
Rebased and applied, thanks.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 18/29] tty: ar933x_uart: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (16 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 17/29] drivers/rtc: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:11 ` [PATCH 19/29] watchdog: ts72xx_wdt: " Julia Lawall
` (9 subsequent siblings)
27 siblings, 0 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: kernel-janitors, Jiri Slaby, linux-serial, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/tty/serial/ar933x_uart.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c
index 3f5517f..a712a3f 100644
--- a/drivers/tty/serial/ar933x_uart.c
+++ b/drivers/tty/serial/ar933x_uart.c
@@ -640,12 +640,6 @@ static int ar933x_uart_probe(struct platform_device *pdev)
if (id > CONFIG_SERIAL_AR933X_NR_UARTS)
return -EINVAL;
- mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!mem_res) {
- dev_err(&pdev->dev, "no MEM resource\n");
- return -EINVAL;
- }
-
irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!irq_res) {
dev_err(&pdev->dev, "no IRQ resource\n");
@@ -659,6 +653,7 @@ static int ar933x_uart_probe(struct platform_device *pdev)
port = &up->port;
+ mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
port->membase = devm_ioremap_resource(&pdev->dev, mem_res);
if (IS_ERR(port->membase))
return PTR_ERR(port->membase);
^ permalink raw reply related [flat|nested] 56+ messages in thread* [PATCH 19/29] watchdog: ts72xx_wdt: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (17 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 18/29] tty: ar933x_uart: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-15 3:18 ` Guenter Roeck
2013-08-14 9:11 ` [PATCH 20/29] watchdog: s3c2410_wdt: " Julia Lawall
` (8 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Wim Van Sebroeck; +Cc: kernel-janitors, linux-watchdog, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Remove unneeded error handling on the result of a call to
platform_get_resource 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,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>
---
drivers/watchdog/ts72xx_wdt.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/watchdog/ts72xx_wdt.c b/drivers/watchdog/ts72xx_wdt.c
index 4da59b4..42913f1 100644
--- a/drivers/watchdog/ts72xx_wdt.c
+++ b/drivers/watchdog/ts72xx_wdt.c
@@ -403,21 +403,11 @@ static int ts72xx_wdt_probe(struct platform_device *pdev)
}
r1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!r1) {
- dev_err(&pdev->dev, "failed to get memory resource\n");
- return -ENODEV;
- }
-
wdt->control_reg = devm_ioremap_resource(&pdev->dev, r1);
if (IS_ERR(wdt->control_reg))
return PTR_ERR(wdt->control_reg);
r2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!r2) {
- dev_err(&pdev->dev, "failed to get memory resource\n");
- return -ENODEV;
- }
-
wdt->feed_reg = devm_ioremap_resource(&pdev->dev, r2);
if (IS_ERR(wdt->feed_reg))
return PTR_ERR(wdt->feed_reg);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 19/29] watchdog: ts72xx_wdt: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 19/29] watchdog: ts72xx_wdt: " Julia Lawall
@ 2013-08-15 3:18 ` Guenter Roeck
0 siblings, 0 replies; 56+ messages in thread
From: Guenter Roeck @ 2013-08-15 3:18 UTC (permalink / raw)
To: Julia Lawall
Cc: Wim Van Sebroeck, kernel-janitors, linux-watchdog, linux-kernel
On 08/14/2013 02:11 AM, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Remove unneeded error handling on the result of a call to
> platform_get_resource 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,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>
>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 20/29] watchdog: s3c2410_wdt: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (18 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 19/29] watchdog: ts72xx_wdt: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-15 3:19 ` Guenter Roeck
2013-08-14 9:11 ` [PATCH 21/29] pwm: " Julia Lawall
` (7 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: linux-arm-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/watchdog/s3c2410_wdt.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 6a22cf5..9fbc993 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -325,12 +325,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
dev = &pdev->dev;
wdt_dev = &pdev->dev;
- wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (wdt_mem = NULL) {
- dev_err(dev, "no memory resource specified\n");
- return -ENOENT;
- }
-
wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (wdt_irq = NULL) {
dev_err(dev, "no irq resource specified\n");
@@ -339,6 +333,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
}
/* get the memory region for the watchdog timer */
+ wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
wdt_base = devm_ioremap_resource(dev, wdt_mem);
if (IS_ERR(wdt_base)) {
ret = PTR_ERR(wdt_base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 20/29] watchdog: s3c2410_wdt: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 20/29] watchdog: s3c2410_wdt: " Julia Lawall
@ 2013-08-15 3:19 ` Guenter Roeck
0 siblings, 0 replies; 56+ messages in thread
From: Guenter Roeck @ 2013-08-15 3:19 UTC (permalink / raw)
To: linux-arm-kernel
On 08/14/2013 02:11 AM, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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>
>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 21/29] pwm: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (19 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 20/29] watchdog: s3c2410_wdt: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:17 ` Thierry Reding
2013-08-14 9:28 ` Viresh Kumar
2013-08-14 9:11 ` [PATCH 22/29] host1x/{dev.c,drm/hdmi.c}: " Julia Lawall
` (6 subsequent siblings)
27 siblings, 2 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Thierry Reding; +Cc: kernel-janitors, linux-pwm, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/pwm/pwm-lpc32xx.c | 3 ---
drivers/pwm/pwm-renesas-tpu.c | 5 -----
drivers/pwm/pwm-spear.c | 7 +------
3 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
index efb6c7b..efac99e 100644
--- a/drivers/pwm/pwm-lpc32xx.c
+++ b/drivers/pwm/pwm-lpc32xx.c
@@ -124,9 +124,6 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -EINVAL;
-
lpc32xx->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(lpc32xx->base))
return PTR_ERR(lpc32xx->base);
diff --git a/drivers/pwm/pwm-renesas-tpu.c b/drivers/pwm/pwm-renesas-tpu.c
index 2600892..444d589 100644
--- a/drivers/pwm/pwm-renesas-tpu.c
+++ b/drivers/pwm/pwm-renesas-tpu.c
@@ -404,11 +404,6 @@ static int tpu_probe(struct platform_device *pdev)
/* Map memory, get clock and pin control. */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "failed to get I/O memory\n");
- return -ENXIO;
- }
-
tpu->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(tpu->base))
return PTR_ERR(tpu->base);
diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c
index a54d214..8ad26b8 100644
--- a/drivers/pwm/pwm-spear.c
+++ b/drivers/pwm/pwm-spear.c
@@ -178,18 +178,13 @@ static int spear_pwm_probe(struct platform_device *pdev)
int ret;
u32 val;
- r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!r) {
- dev_err(&pdev->dev, "no memory resources defined\n");
- return -ENODEV;
- }
-
pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
if (!pc) {
dev_err(&pdev->dev, "failed to allocate memory\n");
return -ENOMEM;
}
+ r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
if (IS_ERR(pc->mmio_base))
return PTR_ERR(pc->mmio_base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 21/29] pwm: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 21/29] pwm: " Julia Lawall
@ 2013-08-14 9:17 ` Thierry Reding
2013-08-14 9:28 ` Viresh Kumar
1 sibling, 0 replies; 56+ messages in thread
From: Thierry Reding @ 2013-08-14 9:17 UTC (permalink / raw)
To: Julia Lawall; +Cc: kernel-janitors, linux-pwm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]
On Wed, Aug 14, 2013 at 11:11:25AM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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>
>
> ---
> drivers/pwm/pwm-lpc32xx.c | 3 ---
> drivers/pwm/pwm-renesas-tpu.c | 5 -----
> drivers/pwm/pwm-spear.c | 7 +------
> 3 files changed, 1 insertion(+), 14 deletions(-)
Applied, thanks.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 21/29] pwm: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 21/29] pwm: " Julia Lawall
2013-08-14 9:17 ` Thierry Reding
@ 2013-08-14 9:28 ` Viresh Kumar
1 sibling, 0 replies; 56+ messages in thread
From: Viresh Kumar @ 2013-08-14 9:28 UTC (permalink / raw)
To: Julia Lawall
Cc: Thierry Reding, kernel-janitors, linux-pwm,
linux-kernel@vger.kernel.org, spear-devel
On Wed, Aug 14, 2013 at 2:41 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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>
>
> ---
> drivers/pwm/pwm-spear.c | 7 +------
For SPEAr:
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c
> index a54d214..8ad26b8 100644
> --- a/drivers/pwm/pwm-spear.c
> +++ b/drivers/pwm/pwm-spear.c
> @@ -178,18 +178,13 @@ static int spear_pwm_probe(struct platform_device *pdev)
> int ret;
> u32 val;
>
> - r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!r) {
> - dev_err(&pdev->dev, "no memory resources defined\n");
> - return -ENODEV;
> - }
> -
> pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
> if (!pc) {
> dev_err(&pdev->dev, "failed to allocate memory\n");
> return -ENOMEM;
> }
>
> + r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
> if (IS_ERR(pc->mmio_base))
> return PTR_ERR(pc->mmio_base);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 22/29] host1x/{dev.c,drm/hdmi.c}: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (20 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 21/29] pwm: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:11 ` [PATCH 23/29] drivers/i2c/busses/i2c-ocores.c: " Julia Lawall
` (5 subsequent siblings)
27 siblings, 0 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Thierry Reding
Cc: kernel-janitors, Terje Bergström, dri-devel, linux-tegra,
linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/gpu/host1x/dev.c | 7 +------
drivers/gpu/host1x/drm/hdmi.c | 3 ---
2 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 28e28a2..e615edd 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -98,12 +98,6 @@ static int host1x_probe(struct platform_device *pdev)
if (!id)
return -EINVAL;
- regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!regs) {
- dev_err(&pdev->dev, "failed to get registers\n");
- return -ENXIO;
- }
-
syncpt_irq = platform_get_irq(pdev, 0);
if (syncpt_irq < 0) {
dev_err(&pdev->dev, "failed to get IRQ\n");
@@ -120,6 +114,7 @@ static int host1x_probe(struct platform_device *pdev)
/* set common host1x device data */
platform_set_drvdata(pdev, host);
+ regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
host->regs = devm_ioremap_resource(&pdev->dev, regs);
if (IS_ERR(host->regs))
return PTR_ERR(host->regs);
diff --git a/drivers/gpu/host1x/drm/hdmi.c b/drivers/gpu/host1x/drm/hdmi.c
index 01097da..9ffece6 100644
--- a/drivers/gpu/host1x/drm/hdmi.c
+++ b/drivers/gpu/host1x/drm/hdmi.c
@@ -1248,9 +1248,6 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
return err;
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!regs)
- return -ENXIO;
-
hdmi->regs = devm_ioremap_resource(&pdev->dev, regs);
if (IS_ERR(hdmi->regs))
return PTR_ERR(hdmi->regs);
^ permalink raw reply related [flat|nested] 56+ messages in thread* [PATCH 23/29] drivers/i2c/busses/i2c-ocores.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (21 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 22/29] host1x/{dev.c,drm/hdmi.c}: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-15 14:18 ` Wolfram Sang
2013-08-14 9:11 ` [PATCH 24/29] drivers/remoteproc/da8xx_remoteproc.c: " Julia Lawall
` (4 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: kernel-janitors, Wolfram Sang, linux-i2c, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/i2c/busses/i2c-ocores.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index 0e1f824..e686e2c 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -353,10 +353,6 @@ static int ocores_i2c_probe(struct platform_device *pdev)
int ret;
int i;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
-
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
@@ -365,6 +361,7 @@ static int ocores_i2c_probe(struct platform_device *pdev)
if (!i2c)
return -ENOMEM;
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
i2c->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(i2c->base))
return PTR_ERR(i2c->base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 23/29] drivers/i2c/busses/i2c-ocores.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 23/29] drivers/i2c/busses/i2c-ocores.c: " Julia Lawall
@ 2013-08-15 14:18 ` Wolfram Sang
0 siblings, 0 replies; 56+ messages in thread
From: Wolfram Sang @ 2013-08-15 14:18 UTC (permalink / raw)
To: Julia Lawall; +Cc: Peter Korsgaard, kernel-janitors, linux-i2c, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 979 bytes --]
On Wed, Aug 14, 2013 at 11:11:27AM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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>
Applied to for-next, thanks!
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 24/29] drivers/remoteproc/da8xx_remoteproc.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (22 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 23/29] drivers/i2c/busses/i2c-ocores.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2014-02-24 15:07 ` Ohad Ben-Cohen
2013-08-14 9:11 ` [PATCH 25/29] drivers/spi/spi-sirf.c: " Julia Lawall
` (3 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Ohad Ben-Cohen; +Cc: kernel-janitors, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/remoteproc/da8xx_remoteproc.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c
index 129f7b9..bb41ee0 100644
--- a/drivers/remoteproc/da8xx_remoteproc.c
+++ b/drivers/remoteproc/da8xx_remoteproc.c
@@ -201,23 +201,11 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
}
bootreg_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!bootreg_res) {
- dev_err(dev,
- "platform_get_resource(IORESOURCE_MEM, 0): NULL\n");
- return -EADDRNOTAVAIL;
- }
-
- chipsig_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!chipsig_res) {
- dev_err(dev,
- "platform_get_resource(IORESOURCE_MEM, 1): NULL\n");
- return -EADDRNOTAVAIL;
- }
-
bootreg = devm_ioremap_resource(dev, bootreg_res);
if (IS_ERR(bootreg))
return PTR_ERR(bootreg);
+ chipsig_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
chipsig = devm_ioremap_resource(dev, chipsig_res);
if (IS_ERR(chipsig))
return PTR_ERR(chipsig);
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 24/29] drivers/remoteproc/da8xx_remoteproc.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 24/29] drivers/remoteproc/da8xx_remoteproc.c: " Julia Lawall
@ 2014-02-24 15:07 ` Ohad Ben-Cohen
0 siblings, 0 replies; 56+ messages in thread
From: Ohad Ben-Cohen @ 2014-02-24 15:07 UTC (permalink / raw)
To: Julia Lawall
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
On Wed, Aug 14, 2013 at 12:11 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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.
>
...
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Applied and pushed to remoteproc-next, thanks!
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 25/29] drivers/spi/spi-sirf.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (23 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 24/29] drivers/remoteproc/da8xx_remoteproc.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:16 ` Barry Song
2013-08-14 18:09 ` Mark Brown
2013-08-14 9:11 ` [PATCH 26/29] drivers/media/platform/coda.c: " Julia Lawall
` (2 subsequent siblings)
27 siblings, 2 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: linux-arm-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/spi/spi-sirf.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
index 62c92c3..546fae2 100644
--- a/drivers/spi/spi-sirf.c
+++ b/drivers/spi/spi-sirf.c
@@ -588,12 +588,6 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, master);
sspi = spi_master_get_devdata(master);
- mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!mem_res) {
- dev_err(&pdev->dev, "Unable to get IO resource\n");
- ret = -ENODEV;
- goto free_master;
- }
master->num_chipselect = num_cs;
for (i = 0; i < master->num_chipselect; i++) {
@@ -620,6 +614,7 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
}
}
+ mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
sspi->base = devm_ioremap_resource(&pdev->dev, mem_res);
if (IS_ERR(sspi->base)) {
ret = PTR_ERR(sspi->base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* RE: [PATCH 25/29] drivers/spi/spi-sirf.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 25/29] drivers/spi/spi-sirf.c: " Julia Lawall
@ 2013-08-14 9:16 ` Barry Song
2013-08-14 18:09 ` Mark Brown
1 sibling, 0 replies; 56+ messages in thread
From: Barry Song @ 2013-08-14 9:16 UTC (permalink / raw)
To: linux-arm-kernel
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBKdWxpYSBM
YXdhbGwgW21haWx0bzpKdWxpYS5MYXdhbGxAbGlwNi5mcl0NCj4gU2VudDog
V2VkbmVzZGF5LCBBdWd1c3QgMTQsIDIwMTMgNToxMSBQTQ0KPiBUbzogQmFy
cnkgU29uZw0KPiBDYzoga2VybmVsLWphbml0b3JzQHZnZXIua2VybmVsLm9y
ZzsgTWFyayBCcm93bjsNCj4gbGludXgtYXJtLWtlcm5lbEBsaXN0cy5pbmZy
YWRlYWQub3JnOyBsaW51eC1zcGlAdmdlci5rZXJuZWwub3JnOw0KPiBsaW51
eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnDQo+IFN1YmplY3Q6IFtQQVRDSCAy
NS8yOV0gZHJpdmVycy9zcGkvc3BpLXNpcmYuYzogc2ltcGxpZnkgdXNlIG9m
DQo+IGRldm1faW9yZW1hcF9yZXNvdXJjZQ0KPiANCj4gRnJvbTogSnVsaWEg
TGF3YWxsIDxKdWxpYS5MYXdhbGxAbGlwNi5mcj4NCj4gDQo+IFJlbW92ZSB1
bm5lZWRlZCBlcnJvciBoYW5kbGluZyBvbiB0aGUgcmVzdWx0IG9mIGEgY2Fs
bCB0bw0KPiBwbGF0Zm9ybV9nZXRfcmVzb3VyY2Ugd2hlbiB0aGUgdmFsdWUg
aXMgcGFzc2VkIHRvIGRldm1faW9yZW1hcF9yZXNvdXJjZS4NCj4gDQo+IE1v
dmUgdGhlIGNhbGwgdG8gcGxhdGZvcm1fZ2V0X3Jlc291cmNlIGFkamFjZW50
IHRvIHRoZSBjYWxsIHRvDQo+IGRldm1faW9yZW1hcF9yZXNvdXJjZSB0byBt
YWtlIHRoZSBjb25uZWN0aW9uIGJldHdlZW4gdGhlbSBtb3JlIGNsZWFyLg0K
PiANCj4gQSBzaW1wbGlmaWVkIHZlcnNpb24gb2YgdGhlIHNlbWFudGljIHBh
dGNoIHRoYXQgbWFrZXMgdGhpcyBjaGFuZ2UgaXMgYXMNCj4gZm9sbG93czog
KGh0dHA6Ly9jb2NjaW5lbGxlLmxpcDYuZnIvKQ0KPiANCj4gLy8gPHNtcGw+
DQo+IEBADQo+IGV4cHJlc3Npb24gcGRldixyZXMsbixlLGUxOw0KPiBleHBy
ZXNzaW9uIHJldCAhPSAwOw0KPiBpZGVudGlmaWVyIGw7DQo+IEBADQo+IA0K
PiAtIHJlcyA9IHBsYXRmb3JtX2dldF9yZXNvdXJjZShwZGV2LCBJT1JFU09V
UkNFX01FTSwgbik7DQo+ICAgLi4uIHdoZW4gIT0gcmVzDQo+IC0gaWYgKHJl
cyA9PSBOVUxMKSB7IC4uLiBcKGdvdG8gbDtcfHJldHVybiByZXQ7XCkgfQ0K
PiAgIC4uLiB3aGVuICE9IHJlcw0KPiArIHJlcyA9IHBsYXRmb3JtX2dldF9y
ZXNvdXJjZShwZGV2LCBJT1JFU09VUkNFX01FTSwgbik7DQo+ICAgZSA9IGRl
dm1faW9yZW1hcF9yZXNvdXJjZShlMSwgcmVzKTsNCj4gLy8gPC9zbXBsPg0K
PiANCj4gU2lnbmVkLW9mZi1ieTogSnVsaWEgTGF3YWxsIDxKdWxpYS5MYXdh
bGxAbGlwNi5mcj4NCg0KQWNrZWQtYnk6IEJhcnJ5IFNvbmcgPEJhb2h1YS5T
b25nQGNzci5jb20+DQoNCj4gDQo+IC0tLQ0KPiAgZHJpdmVycy9zcGkvc3Bp
LXNpcmYuYyB8ICAgIDcgKy0tLS0tLQ0KPiAgMSBmaWxlIGNoYW5nZWQsIDEg
aW5zZXJ0aW9uKCspLCA2IGRlbGV0aW9ucygtKQ0KIA0KCgpNZW1iZXIgb2Yg
dGhlIENTUiBwbGMgZ3JvdXAgb2YgY29tcGFuaWVzLiBDU1IgcGxjIHJlZ2lz
dGVyZWQgaW4gRW5nbGFuZCBhbmQgV2FsZXMsIHJlZ2lzdGVyZWQgbnVtYmVy
IDQxODczNDYsIHJlZ2lzdGVyZWQgb2ZmaWNlIENodXJjaGlsbCBIb3VzZSwg
Q2FtYnJpZGdlIEJ1c2luZXNzIFBhcmssIENvd2xleSBSb2FkLCBDYW1icmlk
Z2UsIENCNCAwV1osIFVuaXRlZCBLaW5nZG9tCk1vcmUgaW5mb3JtYXRpb24g
Y2FuIGJlIGZvdW5kIGF0IHd3dy5jc3IuY29tLiBGb2xsb3cgQ1NSIG9uIFR3
aXR0ZXIgYXQgaHR0cDovL3R3aXR0ZXIuY29tL0NTUl9QTEMgYW5kIHJlYWQg
b3VyIGJsb2cgYXQgd3d3LmNzci5jb20vYmxvZwo
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 25/29] drivers/spi/spi-sirf.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 25/29] drivers/spi/spi-sirf.c: " Julia Lawall
2013-08-14 9:16 ` Barry Song
@ 2013-08-14 18:09 ` Mark Brown
1 sibling, 0 replies; 56+ messages in thread
From: Mark Brown @ 2013-08-14 18:09 UTC (permalink / raw)
To: linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 269 bytes --]
On Wed, Aug 14, 2013 at 11:11:29AM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Remove unneeded error handling on the result of a call to
> platform_get_resource when the value is passed to devm_ioremap_resource.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 26/29] drivers/media/platform/coda.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (24 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 25/29] drivers/spi/spi-sirf.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:11 ` [PATCH 27/29] drivers/ata/sata_rcar.c: " Julia Lawall
2013-08-14 9:11 ` [PATCH 29/29] usb: dwc3: omap: " Julia Lawall
27 siblings, 0 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: kernel-janitors, linux-media, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Remove unneeded error handling on the result of a call to
platform_get_resource 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,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>
---
drivers/media/platform/coda.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 66db0df..1a2192f 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -3122,11 +3122,6 @@ static int coda_probe(struct platform_device *pdev)
/* Get memory for physical registers */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res = NULL) {
- dev_err(&pdev->dev, "failed to get memory region resource\n");
- return -ENOENT;
- }
-
dev->regs_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(dev->regs_base))
return PTR_ERR(dev->regs_base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* [PATCH 27/29] drivers/ata/sata_rcar.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (25 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 26/29] drivers/media/platform/coda.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 9:11 ` Julia Lawall
2013-08-14 13:32 ` Tejun Heo
2013-08-14 9:11 ` [PATCH 29/29] usb: dwc3: omap: " Julia Lawall
27 siblings, 2 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Tejun Heo; +Cc: kernel-janitors, linux-ide, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/ata/sata_rcar.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index 8108eb0..c2d95e9 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -778,10 +778,6 @@ static int sata_rcar_probe(struct platform_device *pdev)
int irq;
int ret = 0;
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (mem = NULL)
- return -EINVAL;
-
irq = platform_get_irq(pdev, 0);
if (irq <= 0)
return -EINVAL;
@@ -807,6 +803,7 @@ static int sata_rcar_probe(struct platform_device *pdev)
host->private_data = priv;
+ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->base = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(priv->base)) {
ret = PTR_ERR(priv->base);
^ permalink raw reply related [flat|nested] 56+ messages in thread* [PATCH 27/29] drivers/ata/sata_rcar.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 27/29] drivers/ata/sata_rcar.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
2013-08-14 13:32 ` Tejun Heo
1 sibling, 0 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: kernel-janitors
From: Julia Lawall <Julia.Lawall@lip6.fr>
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>
---
drivers/input/keyboard/imx_keypad.c | 7 +------
drivers/input/keyboard/nspire-keypad.c | 7 +------
drivers/input/keyboard/spear-keyboard.c | 7 +------
drivers/input/serio/arc_ps2.c | 7 +------
drivers/input/serio/olpc_apsp.c | 3 ---
5 files changed, 4 insertions(+), 27 deletions(-)
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c
index 03c8cc5..328cfc1 100644
--- a/drivers/input/keyboard/imx_keypad.c
+++ b/drivers/input/keyboard/imx_keypad.c
@@ -442,12 +442,6 @@ static int imx_keypad_probe(struct platform_device *pdev)
return -EINVAL;
}
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res = NULL) {
- dev_err(&pdev->dev, "no I/O memory defined in platform data\n");
- return -EINVAL;
- }
-
input_dev = devm_input_allocate_device(&pdev->dev);
if (!input_dev) {
dev_err(&pdev->dev, "failed to allocate the input device\n");
@@ -468,6 +462,7 @@ static int imx_keypad_probe(struct platform_device *pdev)
setup_timer(&keypad->check_matrix_timer,
imx_keypad_check_for_events, (unsigned long) keypad);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
keypad->mmio_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(keypad->mmio_base))
return PTR_ERR(keypad->mmio_base);
diff --git a/drivers/input/keyboard/nspire-keypad.c b/drivers/input/keyboard/nspire-keypad.c
index 20d872d..b3e3eda 100644
--- a/drivers/input/keyboard/nspire-keypad.c
+++ b/drivers/input/keyboard/nspire-keypad.c
@@ -171,12 +171,6 @@ static int nspire_keypad_probe(struct platform_device *pdev)
return -EINVAL;
}
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "missing platform resources\n");
- return -EINVAL;
- }
-
keypad = devm_kzalloc(&pdev->dev, sizeof(struct nspire_keypad),
GFP_KERNEL);
if (!keypad) {
@@ -208,6 +202,7 @@ static int nspire_keypad_probe(struct platform_device *pdev)
return PTR_ERR(keypad->clk);
}
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
keypad->reg_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(keypad->reg_base))
return PTR_ERR(keypad->reg_base);
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index 7111124..85ff530 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -191,12 +191,6 @@ static int spear_kbd_probe(struct platform_device *pdev)
int irq;
int error;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "no keyboard resource defined\n");
- return -EBUSY;
- }
-
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "not able to get irq for the device\n");
@@ -228,6 +222,7 @@ static int spear_kbd_probe(struct platform_device *pdev)
kbd->suspended_rate = pdata->suspended_rate;
}
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
kbd->io_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(kbd->io_base))
return PTR_ERR(kbd->io_base);
diff --git a/drivers/input/serio/arc_ps2.c b/drivers/input/serio/arc_ps2.c
index 3fb7727..8024a6d 100644
--- a/drivers/input/serio/arc_ps2.c
+++ b/drivers/input/serio/arc_ps2.c
@@ -189,12 +189,6 @@ static int arc_ps2_probe(struct platform_device *pdev)
int irq;
int error, id, i;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "no IO memory defined\n");
- return -EINVAL;
- }
-
irq = platform_get_irq_byname(pdev, "arc_ps2_irq");
if (irq < 0) {
dev_err(&pdev->dev, "no IRQ defined\n");
@@ -208,6 +202,7 @@ static int arc_ps2_probe(struct platform_device *pdev)
return -ENOMEM;
}
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
arc_ps2->addr = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(arc_ps2->addr))
return PTR_ERR(arc_ps2->addr);
diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
index 818aa46..51b1d40 100644
--- a/drivers/input/serio/olpc_apsp.c
+++ b/drivers/input/serio/olpc_apsp.c
@@ -183,9 +183,6 @@ static int olpc_apsp_probe(struct platform_device *pdev)
np = pdev->dev.of_node;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENOENT;
-
priv->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->base)) {
dev_err(&pdev->dev, "Failed to map WTM registers\n");
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 27/29] drivers/ata/sata_rcar.c: simplify use of devm_ioremap_resource
2013-08-14 9:11 ` [PATCH 27/29] drivers/ata/sata_rcar.c: " Julia Lawall
2013-08-14 9:11 ` Julia Lawall
@ 2013-08-14 13:32 ` Tejun Heo
1 sibling, 0 replies; 56+ messages in thread
From: Tejun Heo @ 2013-08-14 13:32 UTC (permalink / raw)
To: Julia Lawall; +Cc: kernel-janitors, linux-ide, linux-kernel
On Wed, Aug 14, 2013 at 11:11:31AM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> 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>
Applied to libata/for-3.12.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 29/29] usb: dwc3: omap: simplify use of devm_ioremap_resource
2013-08-14 9:11 [PATCH 0/29] simplify use of devm_ioremap_resource Julia Lawall
` (26 preceding siblings ...)
2013-08-14 9:11 ` [PATCH 27/29] drivers/ata/sata_rcar.c: " Julia Lawall
@ 2013-08-14 9:11 ` Julia Lawall
27 siblings, 0 replies; 56+ messages in thread
From: Julia Lawall @ 2013-08-14 9:11 UTC (permalink / raw)
To: Felipe Balbi
Cc: kernel-janitors, Greg Kroah-Hartman, linux-usb, linux-omap,
linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Remove unneeded error handling on the result of a call to
platform_get_resource 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,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>
---
drivers/usb/dwc3/dwc3-omap.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 7f7ea62..cbcd972 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -432,11 +432,6 @@ static int dwc3_omap_probe(struct platform_device *pdev)
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(dev, "missing memory base resource\n");
- return -EINVAL;
- }
-
base = devm_ioremap_resource(dev, res);
if (IS_ERR(base))
return PTR_ERR(base);
^ permalink raw reply related [flat|nested] 56+ messages in thread