Dear Anatolij Gustschin,

In message <1323954734-26775-1-git-send-email-ag...@denx.de> you wrote:
> Writing a file to the FAT partition didn't work while a
> test using a CF card. The test was done on mpc5200 based
> board (powerpc). There is a number of problems in FAT
> write code:
> 
> Compiler warning:
> fat_write.c: In function 'file_fat_write':
> fat_write.c:326: warning: 'counter' may be used uninitialized
> in this function
> fat_write.c:326: note: 'counter' was declared here
> 
> 'l_filename' string is not terminated, so a file name
> with garbage at the end is used as a file name as shown
> by debug code.
> 
> Return value of set_contents() is not checked properly
> so actually a file won't be written at all (as checked
> using 'fatls' after a write attempt with 'fatwrite'
> command).
> 
> do_fat_write() doesn't return the number of written bytes
> if no error happened. However the return value of this
> function is used to show the number of written bytes
> in do_fat_fswrite().
> 
> The patch adds some debug code and fixes above mentioned
> problems and also fixes a typo in error output.
> 
> NOTE: after a successful write to the FAT partition (under
> U-Boot) the partition was checked under Linux using fsck.
> The partition needed fixing FATs:
> -bash-3.2# fsck -a /dev/sda1
> fsck 1.39 (29-May-2006)
> dosfsck 2.11, 12 Mar 2005, FAT32, LFN
> FATs differ but appear to be intact. Using first FAT.
> Performing changes.
> 
> Signed-off-by: Anatolij Gustschin <ag...@denx.de>
> Cc: Donggeun Kim <dg77....@samsung.com>
> Cc: Aaron Williams <aaron.willi...@cavium.com>
> ---
>  fs/fat/fat_write.c |   19 ++++++++++++++-----
>  1 files changed, 14 insertions(+), 5 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Emotions are alien to me.  I'm a scientist.
        -- Spock, "This Side of Paradise", stardate 3417.3
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to