linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: joe@perches.com (Joe Perches)
To: linux-arm-kernel@lists.infradead.org
Subject: [trivial PATCH 2/2] arm: mach-u300/gpio: Fix mem_region resource size miscalculations
Date: Wed, 23 Mar 2011 12:55:37 -0700	[thread overview]
Message-ID: <798d0aea7272beadf2ee838f7aa27f86cfe7f9ba.1300909446.git.joe@perches.com> (raw)
In-Reply-To: <cover.1300909445.git.joe@perches.com>

Convert off-by-1 r->end - r->start to resource_size(r)

Signed-off-by: Joe Perches <joe@perches.com>
---
 arch/arm/mach-u300/gpio.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-u300/gpio.c b/arch/arm/mach-u300/gpio.c
index d927901..94837a4 100644
--- a/arch/arm/mach-u300/gpio.c
+++ b/arch/arm/mach-u300/gpio.c
@@ -581,8 +581,7 @@ static int __init gpio_probe(struct platform_device *pdev)
 	if (!memres)
 		goto err_no_resource;
 
-	if (request_mem_region(memres->start, memres->end - memres->start, "GPIO Controller")
-	    == NULL) {
+	if (!request_mem_region(memres->start, resource_size(memres), "GPIO Controller")) {
 		err = -ENODEV;
 		goto err_no_ioregion;
 	}
@@ -640,7 +639,7 @@ static int __init gpio_probe(struct platform_device *pdev)
 		free_irq(gpio_ports[i].irq, &gpio_ports[i]);
 	iounmap(virtbase);
  err_no_ioremap:
-	release_mem_region(memres->start, memres->end - memres->start);
+	release_mem_region(memres->start, resource_size(memres));
  err_no_ioregion:
  err_no_resource:
 	clk_disable(clk);
@@ -660,7 +659,7 @@ static int __exit gpio_remove(struct platform_device *pdev)
 	for (i = 0 ; i < U300_GPIO_NUM_PORTS; i++)
 		free_irq(gpio_ports[i].irq, &gpio_ports[i]);
 	iounmap(virtbase);
-	release_mem_region(memres->start, memres->end - memres->start);
+	release_mem_region(memres->start, resource_size(memres));
 	clk_disable(clk);
 	clk_put(clk);
 	return 0;
-- 
1.7.4.2.g597a6.dirty

  parent reply	other threads:[~2011-03-23 19:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 19:55 [PATCH 0/2] Fix resource size miscalculations Joe Perches
2011-03-23 19:55 ` [trivial PATCH 1/2] treewide: Fix iomap " Joe Perches
2011-03-23 20:11   ` Linus Walleij
2011-03-23 20:29   ` Florian Fainelli
2011-03-23 22:42   ` David Brown
2011-03-24  8:29   ` Wim Van Sebroeck
2011-03-24 22:27   ` Ralf Baechle
2011-04-10 15:09   ` Jiri Kosina
2011-03-23 19:55 ` Joe Perches [this message]
2011-03-23 20:07   ` [trivial PATCH 2/2] arm: mach-u300/gpio: Fix mem_region " Linus Walleij
2011-04-10 15:07     ` Jiri Kosina
2011-03-24 22:49 ` [PATCH 0/2] Fix " Joe Perches

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=798d0aea7272beadf2ee838f7aa27f86cfe7f9ba.1300909446.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=linux-arm-kernel@lists.infradead.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 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).