diff mbox

[U-Boot,1/2] FAT write: Fix compile errors

Message ID 1332427136-13918-1-git-send-email-mvs@tigris.de
State Accepted
Commit 079df7223c05518687cbd2eb9ad1b3d1712ee6d7
Delegated to: Anatolij Gustschin
Headers show

Commit Message

Maximilian Schwerin March 22, 2012, 2:38 p.m. UTC
This patch removes compile errors introduced by
'fs/fat: Fix FAT detection to support non-DOS partition tables'.

This patch was originally part of

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/121847

Reported-by: Donggeun Kim <dg77.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
 fs/fat/fat_write.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

Comments

Anatolij Gustschin March 25, 2012, 12:17 a.m. UTC | #1
Hello Maximilian,

On Thu, 22 Mar 2012 15:38:55 +0100
Maximilian Schwerin <mvs@tigris.de> wrote:

> This patch removes compile errors introduced by
> 'fs/fat: Fix FAT detection to support non-DOS partition tables'.
> 
> This patch was originally part of
> 
> http://article.gmane.org/gmane.comp.boot-loaders.u-boot/121847
> 
> Reported-by: Donggeun Kim <dg77.kim@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  fs/fat/fat_write.c |   20 ++++++++------------
>  1 files changed, 8 insertions(+), 12 deletions(-)

Applied to u-boot-staging/agust@denx.de after fixing
commit log and all attribution tags.

NOTE: When submitting patches from other people you should
preserve their authorship and SoB and add your SoB.

Thanks,
Anatolij
diff mbox

Patch

diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 3bfc1c4..16f8400 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -41,23 +41,19 @@  static void uppercase(char *str, int len)
 }
 
 static int total_sector;
-static int disk_write(__u32 startblock, __u32 getsize, __u8 *bufptr)
+static int disk_write(__u32 block, __u32 nr_blocks, void *buf)
 {
-	if (cur_dev == NULL)
+	if (!cur_dev || !cur_dev->block_write)
 		return -1;
 
-	if (startblock + getsize > total_sector) {
+	if (cur_part_info.start + block + nr_blocks >
+		cur_part_info.start + total_sector) {
 		printf("error: overflow occurs\n");
 		return -1;
 	}
 
-	startblock += part_offset;
-
-	if (cur_dev->block_read) {
-		return cur_dev->block_write(cur_dev->dev, startblock, getsize,
-					   (unsigned long *) bufptr);
-	}
-	return -1;
+	return cur_dev->block_write(cur_dev->dev,
+			cur_part_info.start + block, nr_blocks,	buf);
 }
 
 /*
@@ -797,7 +793,7 @@  static int check_overflow(fsdata *mydata, __u32 clustnum, unsigned long size)
 	if (size % mydata->sect_size)
 		sect_num++;
 
-	if (startsect + sect_num > total_sector)
+	if (startsect + sect_num > cur_part_info.start + total_sector)
 		return -1;
 
 	return 0;
@@ -947,7 +943,7 @@  static int do_fat_write(const char *filename, void *buffer,
 
 	total_sector = bs.total_sect;
 	if (total_sector == 0)
-		total_sector = part_size;
+		total_sector = cur_part_info.size;
 
 	root_cluster = bs.root_cluster;