Skip to content

Commit

Permalink
USB: isp1760: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Tobias Klauser authored and Greg Kroah-Hartman committed May 20, 2010
1 parent 0ba169a commit e07afd3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/usb/host/isp1760-if.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static int of_isp1760_probe(struct of_device *dev,
struct resource memory;
struct of_irq oirq;
int virq;
u64 res_len;
resource_size_t res_len;
int ret;
const unsigned int *prop;
unsigned int devflags = 0;
Expand All @@ -45,13 +45,12 @@ static int of_isp1760_probe(struct of_device *dev,
if (ret)
return -ENXIO;

res = request_mem_region(memory.start, memory.end - memory.start + 1,
dev_name(&dev->dev));
res_len = resource_size(&memory);

res = request_mem_region(memory.start, res_len, dev_name(&dev->dev));
if (!res)
return -EBUSY;

res_len = memory.end - memory.start + 1;

if (of_irq_map_one(dp, 0, &oirq)) {
ret = -ENODEV;
goto release_reg;
Expand Down Expand Up @@ -92,7 +91,7 @@ static int of_isp1760_probe(struct of_device *dev,
return ret;

release_reg:
release_mem_region(memory.start, memory.end - memory.start + 1);
release_mem_region(memory.start, res_len);
return ret;
}

Expand Down

0 comments on commit e07afd3

Please sign in to comment.