提交 e07afd3f 编写于 作者: T Tobias Klauser 提交者: Greg Kroah-Hartman

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: NTobias Klauser <tklauser@distanz.ch>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 0ba169af
...@@ -36,7 +36,7 @@ static int of_isp1760_probe(struct of_device *dev, ...@@ -36,7 +36,7 @@ static int of_isp1760_probe(struct of_device *dev,
struct resource memory; struct resource memory;
struct of_irq oirq; struct of_irq oirq;
int virq; int virq;
u64 res_len; resource_size_t res_len;
int ret; int ret;
const unsigned int *prop; const unsigned int *prop;
unsigned int devflags = 0; unsigned int devflags = 0;
...@@ -45,13 +45,12 @@ static int of_isp1760_probe(struct of_device *dev, ...@@ -45,13 +45,12 @@ static int of_isp1760_probe(struct of_device *dev,
if (ret) if (ret)
return -ENXIO; return -ENXIO;
res = request_mem_region(memory.start, memory.end - memory.start + 1, res_len = resource_size(&memory);
dev_name(&dev->dev));
res = request_mem_region(memory.start, res_len, dev_name(&dev->dev));
if (!res) if (!res)
return -EBUSY; return -EBUSY;
res_len = memory.end - memory.start + 1;
if (of_irq_map_one(dp, 0, &oirq)) { if (of_irq_map_one(dp, 0, &oirq)) {
ret = -ENODEV; ret = -ENODEV;
goto release_reg; goto release_reg;
...@@ -92,7 +91,7 @@ static int of_isp1760_probe(struct of_device *dev, ...@@ -92,7 +91,7 @@ static int of_isp1760_probe(struct of_device *dev,
return ret; return ret;
release_reg: release_reg:
release_mem_region(memory.start, memory.end - memory.start + 1); release_mem_region(memory.start, res_len);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册