summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShubhrajyoti D <shubhrajyoti@ti.com>2011-10-24 14:24:24 +0400
committerGrant Likely <grant.likely@secretlab.ca>2011-10-24 15:44:30 +0400
commit1458d160de3f1862aeaac57447ba96e7857ac52b (patch)
tree98565db94ae3af17c6ac4a645f557818ff2e9ef3
parenta853ba8d6d5d76bcbc5bf35b945b5727b5e5a36d (diff)
downloadlinux-1458d160de3f1862aeaac57447ba96e7857ac52b.tar.xz
OMAP: SPI: Fix the trying to free nonexistent resource error
Currently there is a request_mem_region(r->start, .. followed by r->start += pdata->regs_offset; And then in remove r = platform_get_resource(pdev, IORESOURCE_MEM, 0); release_mem_region(r->start, resource_size(r)); Here the offset addition is not taken care. Fix the code for the same. Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--drivers/spi/spi-omap2-mcspi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index fde3a2d4f120..322be7aea8b4 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1116,15 +1116,16 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
status = -ENODEV;
goto err1;
}
+
+ r->start += pdata->regs_offset;
+ r->end += pdata->regs_offset;
+ mcspi->phys = r->start;
if (!request_mem_region(r->start, resource_size(r),
dev_name(&pdev->dev))) {
status = -EBUSY;
goto err1;
}
- r->start += pdata->regs_offset;
- r->end += pdata->regs_offset;
- mcspi->phys = r->start;
mcspi->base = ioremap(r->start, resource_size(r));
if (!mcspi->base) {
dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");