Commit 311e54c0 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Samuel Ortiz

mfd: Use resource_size() in sm501

The requested memory region is smaller than the actual ioremap().
Use resource_size() to get the correct size.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 08b8499b
...@@ -1430,7 +1430,7 @@ static int __devinit sm501_plat_probe(struct platform_device *dev) ...@@ -1430,7 +1430,7 @@ static int __devinit sm501_plat_probe(struct platform_device *dev)
} }
sm->regs_claim = request_mem_region(sm->io_res->start, sm->regs_claim = request_mem_region(sm->io_res->start,
0x100, "sm501"); resource_size(sm->io_res), "sm501");
if (sm->regs_claim == NULL) { if (sm->regs_claim == NULL) {
dev_err(&dev->dev, "cannot claim registers\n"); dev_err(&dev->dev, "cannot claim registers\n");
...@@ -1440,8 +1440,7 @@ static int __devinit sm501_plat_probe(struct platform_device *dev) ...@@ -1440,8 +1440,7 @@ static int __devinit sm501_plat_probe(struct platform_device *dev)
platform_set_drvdata(dev, sm); platform_set_drvdata(dev, sm);
sm->regs = ioremap(sm->io_res->start, sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res));
(sm->io_res->end - sm->io_res->start) - 1);
if (sm->regs == NULL) { if (sm->regs == NULL) {
dev_err(&dev->dev, "cannot remap registers\n"); dev_err(&dev->dev, "cannot remap registers\n");
...@@ -1645,7 +1644,7 @@ static int __devinit sm501_pci_probe(struct pci_dev *dev, ...@@ -1645,7 +1644,7 @@ static int __devinit sm501_pci_probe(struct pci_dev *dev,
sm->mem_res = &dev->resource[0]; sm->mem_res = &dev->resource[0];
sm->regs_claim = request_mem_region(sm->io_res->start, sm->regs_claim = request_mem_region(sm->io_res->start,
0x100, "sm501"); resource_size(sm->io_res), "sm501");
if (sm->regs_claim == NULL) { if (sm->regs_claim == NULL) {
dev_err(&dev->dev, "cannot claim registers\n"); dev_err(&dev->dev, "cannot claim registers\n");
err= -EBUSY; err= -EBUSY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment