* [PATCH] drivers: mtd: nand: davinci: use devm_ioremap_resource()
@ 2013-05-02 13:22 Laurent Navet
2013-05-02 13:30 ` Sergei Shtylyov
0 siblings, 1 reply; 2+ messages in thread
From: Laurent Navet @ 2013-05-02 13:22 UTC (permalink / raw)
To: dwmw2
Cc: artem.bityutskiy, sshtylyov, m-karicheri2, mturquette, linux-mtd,
linux-kernel, Laurent Navet
Replace a call to deprecated devm_request_and_ioremap by devm_ioremap_resource.
Found with coccicheck and this semantic patch:
scripts/coccinelle/api/devm_request_and_ioremap.cocci.
Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
---
drivers/mtd/nand/davinci_nand.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index 94e17af..4a96e58 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -623,11 +623,14 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
goto err_nomem;
}
- vaddr = devm_request_and_ioremap(&pdev->dev, res1);
- base = devm_request_and_ioremap(&pdev->dev, res2);
- if (!vaddr || !base) {
- dev_err(&pdev->dev, "ioremap failed\n");
- ret = -EADDRNOTAVAIL;
+ vaddr = devm_ioremap_resource(&pdev->dev, res1);
+ base = devm_ioremap_resource(&pdev->dev, res2);
+ if (IS_ERR(vaddr)) {
+ ret = PTR_ERR(vaddr);
+ goto err_ioremap;
+ }
+ if (IS_ERR(base)) {
+ ret = PTR_ERR(base);
goto err_ioremap;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] drivers: mtd: nand: davinci: use devm_ioremap_resource()
2013-05-02 13:22 [PATCH] drivers: mtd: nand: davinci: use devm_ioremap_resource() Laurent Navet
@ 2013-05-02 13:30 ` Sergei Shtylyov
0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2013-05-02 13:30 UTC (permalink / raw)
To: Laurent Navet
Cc: dwmw2, artem.bityutskiy, m-karicheri2, mturquette, linux-mtd,
linux-kernel
Hello.
On 02-05-2013 17:22, Laurent Navet wrote:
> Replace a call to deprecated devm_request_and_ioremap by devm_ioremap_resource.
> Found with coccicheck and this semantic patch:
> scripts/coccinelle/api/devm_request_and_ioremap.cocci.
> Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
> ---
> drivers/mtd/nand/davinci_nand.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
> diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
> index 94e17af..4a96e58 100644
> --- a/drivers/mtd/nand/davinci_nand.c
> +++ b/drivers/mtd/nand/davinci_nand.c
> @@ -623,11 +623,14 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
> goto err_nomem;
> }
>
> - vaddr = devm_request_and_ioremap(&pdev->dev, res1);
> - base = devm_request_and_ioremap(&pdev->dev, res2);
> - if (!vaddr || !base) {
> - dev_err(&pdev->dev, "ioremap failed\n");
> - ret = -EADDRNOTAVAIL;
> + vaddr = devm_ioremap_resource(&pdev->dev, res1);
> + base = devm_ioremap_resource(&pdev->dev, res2);
I'd rather put this line before its corresponding error check.
> + if (IS_ERR(vaddr)) {
> + ret = PTR_ERR(vaddr);
> + goto err_ioremap;
> + }
> + if (IS_ERR(base)) {
> + ret = PTR_ERR(base);
> goto err_ioremap;
> }
WBR, Sergei
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-02 13:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-02 13:22 [PATCH] drivers: mtd: nand: davinci: use devm_ioremap_resource() Laurent Navet
2013-05-02 13:30 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox