All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benoit Taine <benoit.taine@lip6.fr>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/2 v3] lpc_eth: Use resource_size instead of computation
Date: Mon, 02 Jun 2014 11:34:30 +0000	[thread overview]
Message-ID: <20140602113430.GA3823@lip6.fr> (raw)
In-Reply-To: <20140602112419.GA3625@lip6.fr>

This issue was reported by coccicheck using the semantic patch 
at scripts/coccinelle/api/resource_size.cocci

Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
---
Not compile tested, due incompatible architecture.

Changes from V2:
 - added line break to debug message

Changes from V1:
 - Use %pR format type with the debug message (Thanks to Joe Perches)

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 422d9b5..645dac3 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1361,7 +1361,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
        __lpc_eth_clock_enable(pldat, true);
 
        /* Map IO space */
-       pldat->net_base = ioremap(res->start, res->end - res->start + 1);
+       pldat->net_base = ioremap(res->start, resource_size(res));
        if (!pldat->net_base) {
                dev_err(&pdev->dev, "failed to map registers\n");
                ret = -ENOMEM;
@@ -1417,10 +1417,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
        }
        pldat->dma_buff_base_p = dma_handle;
 
-       netdev_dbg(ndev, "IO address start     :0x%08x\n",
-                       res->start);
-       netdev_dbg(ndev, "IO address size      :%d\n",
-                       res->end - res->start + 1);
+       netdev_dbg(ndev, "IO address space     :%pR\n", res);
+       netdev_dbg(ndev, "IO address size      :%d\n", resource_size(res));
        netdev_dbg(ndev, "IO address (mapped)  :0x%p\n",
                        pldat->net_base);
        netdev_dbg(ndev, "IRQ number           :%d\n", ndev->irq);


WARNING: multiple messages have this Message-ID (diff)
From: Benoit Taine <benoit.taine@lip6.fr>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/2 v3] lpc_eth: Use resource_size instead of computation
Date: Mon, 2 Jun 2014 13:34:30 +0200	[thread overview]
Message-ID: <20140602113430.GA3823@lip6.fr> (raw)
In-Reply-To: <20140602112419.GA3625@lip6.fr>

This issue was reported by coccicheck using the semantic patch 
at scripts/coccinelle/api/resource_size.cocci

Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
---
Not compile tested, due incompatible architecture.

Changes from V2:
 - added line break to debug message

Changes from V1:
 - Use %pR format type with the debug message (Thanks to Joe Perches)

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 422d9b5..645dac3 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1361,7 +1361,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
        __lpc_eth_clock_enable(pldat, true);
 
        /* Map IO space */
-       pldat->net_base = ioremap(res->start, res->end - res->start + 1);
+       pldat->net_base = ioremap(res->start, resource_size(res));
        if (!pldat->net_base) {
                dev_err(&pdev->dev, "failed to map registers\n");
                ret = -ENOMEM;
@@ -1417,10 +1417,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
        }
        pldat->dma_buff_base_p = dma_handle;
 
-       netdev_dbg(ndev, "IO address start     :0x%08x\n",
-                       res->start);
-       netdev_dbg(ndev, "IO address size      :%d\n",
-                       res->end - res->start + 1);
+       netdev_dbg(ndev, "IO address space     :%pR\n", res);
+       netdev_dbg(ndev, "IO address size      :%d\n", resource_size(res));
        netdev_dbg(ndev, "IO address (mapped)  :0x%p\n",
                        pldat->net_base);
        netdev_dbg(ndev, "IRQ number           :%d\n", ndev->irq);


  reply	other threads:[~2014-06-02 11:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28 15:14 [PATCH 0/2] Use resource_size instead of computation Benoit Taine
2014-05-28 15:14 ` Benoit Taine
2014-05-28 15:14 ` [PATCH 1/2] ALSA: au1x00: " Benoit Taine
2014-05-28 15:14   ` Benoit Taine
2014-05-28 15:51   ` Takashi Iwai
2014-05-28 15:51     ` Takashi Iwai
2014-05-28 15:14 ` [PATCH 2/2] lpc_eth: " Benoit Taine
2014-05-28 15:14   ` Benoit Taine
2014-05-28 16:16   ` Joe Perches
2014-05-28 16:16     ` Joe Perches
2014-06-02  2:27   ` David Miller
2014-06-02  2:27     ` David Miller
2014-06-02 11:24     ` [PATCH 2/2 v2] " Benoit Taine
2014-06-02 11:24       ` Benoit Taine
2014-06-02 11:34       ` Benoit Taine [this message]
2014-06-02 11:34         ` [PATCH 2/2 v3] " Benoit Taine
2014-06-02 17:58         ` David Miller
2014-06-02 17:58           ` David Miller
2014-06-03 10:32         ` [PATCH 2/2 v4] " Benoit Taine
2014-06-03 10:32           ` Benoit Taine
2014-06-03 10:45           ` [PATCH 2/2 v5] " Benoit Taine
2014-06-03 10:45             ` Benoit Taine
2014-06-03 23:09             ` David Miller
2014-06-03 23:09               ` David Miller
2014-06-02  7:45   ` [PATCH 2/2] " walter harms
2014-06-02 11:28   ` Benoit Taine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140602113430.GA3823@lip6.fr \
    --to=benoit.taine@lip6.fr \
    --cc=davem@davemloft.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.