diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2010-05-05 05:18:41 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:42 -0400 |
commit | e07afd3fb906647d37108206075834f8c670b7e3 (patch) | |
tree | d47b5ab15edeacbc9db25b733e93fe5f894e72a1 /drivers/usb/host/isp1760-if.c | |
parent | 0ba169aff9181389f30f225ad92e113eeb2290b9 (diff) |
USB: isp1760: Use resource_size
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>
Diffstat (limited to 'drivers/usb/host/isp1760-if.c')
-rw-r--r-- | drivers/usb/host/isp1760-if.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index 42a094605c92..8f0259eaa2c7 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c | |||
@@ -36,7 +36,7 @@ static int of_isp1760_probe(struct of_device *dev, | |||
36 | struct resource memory; | 36 | struct resource memory; |
37 | struct of_irq oirq; | 37 | struct of_irq oirq; |
38 | int virq; | 38 | int virq; |
39 | u64 res_len; | 39 | resource_size_t res_len; |
40 | int ret; | 40 | int ret; |
41 | const unsigned int *prop; | 41 | const unsigned int *prop; |
42 | unsigned int devflags = 0; | 42 | unsigned int devflags = 0; |
@@ -45,13 +45,12 @@ static int of_isp1760_probe(struct of_device *dev, | |||
45 | if (ret) | 45 | if (ret) |
46 | return -ENXIO; | 46 | return -ENXIO; |
47 | 47 | ||
48 | res = request_mem_region(memory.start, memory.end - memory.start + 1, | 48 | res_len = resource_size(&memory); |
49 | dev_name(&dev->dev)); | 49 | |
50 | res = request_mem_region(memory.start, res_len, dev_name(&dev->dev)); | ||
50 | if (!res) | 51 | if (!res) |
51 | return -EBUSY; | 52 | return -EBUSY; |
52 | 53 | ||
53 | res_len = memory.end - memory.start + 1; | ||
54 | |||
55 | if (of_irq_map_one(dp, 0, &oirq)) { | 54 | if (of_irq_map_one(dp, 0, &oirq)) { |
56 | ret = -ENODEV; | 55 | ret = -ENODEV; |
57 | goto release_reg; | 56 | goto release_reg; |
@@ -92,7 +91,7 @@ static int of_isp1760_probe(struct of_device *dev, | |||
92 | return ret; | 91 | return ret; |
93 | 92 | ||
94 | release_reg: | 93 | release_reg: |
95 | release_mem_region(memory.start, memory.end - memory.start + 1); | 94 | release_mem_region(memory.start, res_len); |
96 | return ret; | 95 | return ret; |
97 | } | 96 | } |
98 | 97 | ||