Patchwork [U-Boot,v6,04/12] cfi_flash: use buffer length in unmap_physmem()

login
register
mail settings
Submitter Kuo-Jung Su
Date July 4, 2013, 3:40 a.m.
Message ID <1372909244-25211-5-git-send-email-dantesu@gmail.com>
Download mbox | patch
Permalink /patch/256781/
State Awaiting Upstream
Delegated to: Stefan Roese
Headers show

Comments

Kuo-Jung Su - July 4, 2013, 3:40 a.m.
From: Kuo-Jung Su <dantesu@faraday-tech.com>

While the flash_detect_legacy() of drivers/mtd/cfi_flash.c
feed unmap_physmem() with MAP_NOCACHE as 2nd parameter,
the do_spi_flash_read_write() of common/cmd_sf.c
feed unmap_physmem() with the length of the mapped buffer
as 2nd parameter.

It's apparently a bug, and I personally think the 2nd parameter
should be the length of the mapped buffer.

Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
CC: Albert Aribaud <albert.u.boot@aribaud.net>
CC: Stefan Roese <sr@denx.de>
---
Changes for v6:
   - Nothing updates

Changes for v5:
   - Initial commit, which is separated from
     "arm: add MMU/D-Cache support for Faraday cores"

 drivers/mtd/cfi_flash.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
1.7.9.5
Stefan Roese - July 25, 2013, 2:46 p.m.
On 07/04/2013 05:40 AM, Kuo-Jung Su wrote:
> From: Kuo-Jung Su <dantesu@faraday-tech.com>
> 
> While the flash_detect_legacy() of drivers/mtd/cfi_flash.c
> feed unmap_physmem() with MAP_NOCACHE as 2nd parameter,
> the do_spi_flash_read_write() of common/cmd_sf.c
> feed unmap_physmem() with the length of the mapped buffer
> as 2nd parameter.
> 
> It's apparently a bug, and I personally think the 2nd parameter
> should be the length of the mapped buffer.
> 
> Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
> CC: Albert Aribaud <albert.u.boot@aribaud.net>
> CC: Stefan Roese <sr@denx.de>

Applied to u-boot-cfi-flash.

Thanks,
Stefan

Patch

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 25a5710..616750d 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1820,7 +1820,7 @@  static int flash_detect_legacy(phys_addr_t base, int banknum)
 					break;
 				else
 					unmap_physmem((void *)info->start[0],
-						      MAP_NOCACHE);
+						      info->portwidth);
 			}
 		}