Skip to content

Commit

Permalink
mfd: Use resource_size() in sm501
Browse files Browse the repository at this point in the history
The requested memory region is smaller than the actual ioremap().
Use resource_size() to get the correct size.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
H Hartley Sweeten authored and Samuel Ortiz committed Mar 7, 2010
1 parent 08b8499 commit 311e54c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/mfd/sm501.c
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,7 @@ static int __devinit sm501_plat_probe(struct platform_device *dev)
}

sm->regs_claim = request_mem_region(sm->io_res->start,
0x100, "sm501");
resource_size(sm->io_res), "sm501");

if (sm->regs_claim == NULL) {
dev_err(&dev->dev, "cannot claim registers\n");
Expand All @@ -1440,8 +1440,7 @@ static int __devinit sm501_plat_probe(struct platform_device *dev)

platform_set_drvdata(dev, sm);

sm->regs = ioremap(sm->io_res->start,
(sm->io_res->end - sm->io_res->start) - 1);
sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res));

if (sm->regs == NULL) {
dev_err(&dev->dev, "cannot remap registers\n");
Expand Down Expand Up @@ -1645,7 +1644,7 @@ static int __devinit sm501_pci_probe(struct pci_dev *dev,
sm->mem_res = &dev->resource[0];

sm->regs_claim = request_mem_region(sm->io_res->start,
0x100, "sm501");
resource_size(sm->io_res), "sm501");
if (sm->regs_claim == NULL) {
dev_err(&dev->dev, "cannot claim registers\n");
err= -EBUSY;
Expand Down

0 comments on commit 311e54c

Please sign in to comment.