diff mbox

[U-Boot,v2] fs: fat: Fix cache align error message in fatwrite

Message ID 1396923166-3616-1-git-send-email-nobuhiro.iwamatsu.yj@renesas.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Nobuhiro Iwamatsu April 8, 2014, 2:12 a.m. UTC
Use of malloc of do_fat_write() causes cache error on ARM v7 platforms.
Perhaps, the same problem will occur at any other CPUs.
This replaces malloc with memalign to fix cache buffer alignment.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Yoshiyuki Ito <yoshiyuki.ito.ub@renesas.com>
Tested-by: Hector Palacios <hector.palacios@digi.com>
---
 v2: Fix commit message.

 fs/fat/fat_write.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini May 13, 2014, 1:51 a.m. UTC | #1
On Tue, Apr 08, 2014 at 11:12:46AM +0900, Nobuhiro Iwamatsu wrote:

> Use of malloc of do_fat_write() causes cache error on ARM v7 platforms.
> Perhaps, the same problem will occur at any other CPUs.
> This replaces malloc with memalign to fix cache buffer alignment.
> 
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> Signed-off-by: Yoshiyuki Ito <yoshiyuki.ito.ub@renesas.com>
> Tested-by: Hector Palacios <hector.palacios@digi.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 9f5e911..cef138e 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -952,7 +952,7 @@  static int do_fat_write(const char *filename, void *buffer,
 	}
 
 	mydata->fatbufnum = -1;
-	mydata->fatbuf = malloc(FATBUFSIZE);
+	mydata->fatbuf = memalign(ARCH_DMA_MINALIGN, FATBUFSIZE);
 	if (mydata->fatbuf == NULL) {
 		debug("Error: allocating memory\n");
 		return -1;