Skip to content

Commit

Permalink
tty: cpm_uart: use resource_size()
Browse files Browse the repository at this point in the history
Use the resource_size function instead of manually calculating the
resource size.  This reduces the chance of introducing off-by-one errors.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Kumar Gala <galak@gate.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Tobias Klauser authored and Greg Kroah-Hartman committed Mar 19, 2010
1 parent d4bee0a commit 2314436
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/serial/cpm_uart/cpm_uart_cpm2.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
void __iomem *pram;
unsigned long offset;
struct resource res;
unsigned long len;
resource_size_t len;

/* Don't remap parameter RAM if it has already been initialized
* during console setup.
Expand All @@ -74,7 +74,7 @@ void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
if (of_address_to_resource(np, 1, &res))
return NULL;

len = 1 + res.end - res.start;
len = resource_size(&res);
pram = ioremap(res.start, len);
if (!pram)
return NULL;
Expand Down

0 comments on commit 2314436

Please sign in to comment.