netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: stmicro: stmmac: use devm_ioremap_resource()
@ 2013-04-11 19:52 Silviu-Mihai Popescu
  2013-04-11 20:23 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Silviu-Mihai Popescu @ 2013-04-11 19:52 UTC (permalink / raw)
  To: netdev; +Cc: Giuseppe Cavallaro, linux-kernel, Silviu-Mihai Popescu

Convert  use of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

This was found with coccinelle.

Signed-off-by: Silviu-Mihai Popescu <silviupopescu1990@gmail.com>
---
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index b43d68b..1d3780f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -88,11 +88,9 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENODEV;
 
-	addr = devm_request_and_ioremap(dev, res);
-	if (!addr) {
-		pr_err("%s: ERROR: memory mapping failed", __func__);
-		return -ENOMEM;
-	}
+	addr = devm_ioremap_resource(dev, res);
+	if (IS_ERR(addr))
+		return PTR_ERR(addr);
 
 	if (pdev->dev.of_node) {
 		plat_dat = devm_kzalloc(&pdev->dev,
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: ethernet: stmicro: stmmac: use devm_ioremap_resource()
  2013-04-11 19:52 [PATCH] net: ethernet: stmicro: stmmac: use devm_ioremap_resource() Silviu-Mihai Popescu
@ 2013-04-11 20:23 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-04-11 20:23 UTC (permalink / raw)
  To: silviupopescu1990; +Cc: netdev, peppe.cavallaro, linux-kernel

From: Silviu-Mihai Popescu <silviupopescu1990@gmail.com>
Date: Thu, 11 Apr 2013 22:52:13 +0300

> Convert  use of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> This was found with coccinelle.
> 
> Signed-off-by: Silviu-Mihai Popescu <silviupopescu1990@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-11 20:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-11 19:52 [PATCH] net: ethernet: stmicro: stmmac: use devm_ioremap_resource() Silviu-Mihai Popescu
2013-04-11 20:23 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).