Skip to contentSkip to conversation

Pb1200/DBAu1200: IDE resource size off by one

PATCH In review Sergei Shtylyov 1 participant 2 messages Apr 14, 2008 – Apr 15, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Pb1200/DBAu1200: IDE resource size off by one

The IDE platform device on Pb1200/DBAu1200 boards claims one byte too many for its memory resource -- fix the platform code and the IDE driver in accordance.

---
I'm not sure thru which tree this should go -- probably thru Linux/MIPS one...

 arch/mips/au1000/common/platform.c |    2 +-
 drivers/ide/mips/au1xxx-ide.c      |    7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
arch/mips/au1000/common/platform.c +1 -1
Index: linux-2.6/arch/mips/au1000/common/platform.c
===================================================================
@@ -189,7 +189,7 @@ static struct resource au1200_lcd_resour
 static struct resource au1200_ide0_resources[] = {
 	[0] = {
 		.start		= AU1XXX_ATA_PHYS_ADDR,
-		.end 		= AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN,
+		.end 		= AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN - 1,
 		.flags		= IORESOURCE_MEM,
 	},
 	[1] = {
drivers/ide/mips/au1xxx-ide.c +4 -3
Index: linux-2.6/drivers/ide/mips/au1xxx-ide.c
===================================================================
@@ -591,13 +591,14 @@ static int au_ide_probe(struct device *d
 		goto out;
 	}
 
-	if (!request_mem_region (res->start, res->end-res->start, pdev->name)) {
+	if (!request_mem_region(res->start, res->end - res->start + 1,
+				pdev->name)) {
 		pr_debug("%s: request_mem_region failed\n", DRV_NAME);
 		ret =  -EBUSY;
 		goto out;
 	}
 
-	ahwif->regbase = (u32)ioremap(res->start, res->end-res->start);
+	ahwif->regbase = (u32)ioremap(res->start, res->end - res->start + 1);
 	if (ahwif->regbase == 0) {
 		ret = -ENOMEM;
 		goto out;
@@ -682,7 +683,7 @@ static int au_ide_remove(struct device *
 	iounmap((void *)ahwif->regbase);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	release_mem_region(res->start, res->end - res->start);
+	release_mem_region(res->start, res->end - res->start + 1);
 
 	return 0;
 }
#1 lore raw
Quoted 2 lines · Hello, I wrote:

The IDE platform device on Pb1200/DBAu1200 boards claims one byte too many for its memory resource -- fix the platform code and the IDE driver in accordance.

Don't apply this patch yet. It turned out that the resource size is
actually twice wrong -- 257 ISO 512. I'll send an updated patch soon.

WBR, Sergei