Skip to content

Commit

Permalink
rapidio: use resource_size()
Browse files Browse the repository at this point in the history
The size calculation is done incorrectly here because it should include
both the start and end (end - start + 1).  It's easiest to just use
resource_size() which does the right thing.

I was worried there was something non-standard going on because the
printk() subtracts "end - 1", but the rest of the file uses the normal
resource size calculations.  This function is only called from
fsl_rio_setup() in arch/powerpc/sysdev/fsl_rio.c and the calculation
there is also:

	port->iores.start = law_start;
	port->iores.end = law_start + law_size - 1;

So I think this is the correct fix.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Cc: Alexandre Bounine <alexandre.bounine@idt.com>
Acked-by: Li Yang <leoli@freescale.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
error27 authored and torvalds committed Nov 12, 2010
1 parent 38b7a2a commit 88cf81f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/rapidio/rio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1159,11 +1159,11 @@ int __devinit rio_init_mports(void)

list_for_each_entry(port, &rio_mports, node) {
if (!request_mem_region(port->iores.start,
port->iores.end - port->iores.start,
resource_size(&port->iores),
port->name)) {
printk(KERN_ERR
"RIO: Error requesting master port region 0x%016llx-0x%016llx\n",
(u64)port->iores.start, (u64)port->iores.end - 1);
(u64)port->iores.start, (u64)port->iores.end);
rc = -ENOMEM;
goto out;
}
Expand Down

0 comments on commit 88cf81f

Please sign in to comment.