[PATCH] spi: omap2-mcspi: fix blatant abuse of the resource subsystem

Lothar Waßmann LW at KARO-electronics.de
Fri Jul 18 04:30:53 PDT 2014


Aua. This really hurts. I wonder how this could ever be admitted to
the Linux kernel...
Further comments suppressed because the would most likely violate the
CDA.

If someone should not grasp what this patch does, they should consider
what happens upon unloading/reloading the kernel module.

Signed-off-by: Lothar Waßmann <LW at KARO-electronics.de>
---
 drivers/spi/spi-omap2-mcspi.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 68441fa..cb23f5d 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1379,15 +1379,13 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
 		goto free_master;
 	}
 
-	r->start += regs_offset;
-	r->end += regs_offset;
-	mcspi->phys = r->start;
-
 	mcspi->base = devm_ioremap_resource(&pdev->dev, r);
 	if (IS_ERR(mcspi->base)) {
 		status = PTR_ERR(mcspi->base);
 		goto free_master;
 	}
+	mcspi->phys = r->start + regs_offset;
+	mcspi->base += regs_offset;
 
 	mcspi->dev = &pdev->dev;
 
-- 
1.7.10.4




More information about the linux-arm-kernel mailing list