Skip to contentSkip to conversation

env_fat.c: Make sure our buffer is cache aligned

PATCH In review Tom Rini 1 participant 2 messages Aug 1, 2014 – Aug 10, 2014

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 env_fat.c: Make sure our buffer is cache aligned

We must ensure the buffer we read the env into is aligned or we may get warnings later on.

---
 common/env_fat.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/env_fat.c +2 -2
index 328c09d..8db0160 100644
@@ -73,7 +73,7 @@ int saveenv(void)
 
 void env_relocate_spec(void)
 {
-	char buf[CONFIG_ENV_SIZE];
+	ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
 	block_dev_desc_t *dev_desc = NULL;
 	disk_partition_t info;
 	int dev, part;
@@ -92,7 +92,7 @@ void env_relocate_spec(void)
 		goto err_env_relocate;
 	}
 
-	err = file_fat_read(FAT_ENV_FILE, (uchar *)&buf, CONFIG_ENV_SIZE);
+	err = file_fat_read(FAT_ENV_FILE, buf, CONFIG_ENV_SIZE);
 	if (err == -1) {
 		printf("\n** Unable to read \"%s\" from %s%d:%d **\n",
 			FAT_ENV_FILE, FAT_ENV_INTERFACE, dev, part);
Signature · 1 line
1.7.9.5
author
#1 lore raw
Quoted 4 lines · Tom Rini

We must ensure the buffer we read the env into is aligned or we may get warnings later on.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140810/f2f4b361/attachment.pgp>