Dear Mirza, In message <CAJ=nTstVijhpwMh9HfCbnzBzRz4GA9aujq=4oswakycus1+...@mail.gmail.com> you wrote: > > > Please update to a recent versionof the code. The return code > > handling has probably been fixed by this commit: > > > > 0a04ed8 2015-09-11 17:15:21 -0400 FIX: fat: Provide correct return co= > de from disk_{read|write} to upper layers > > I did an update (cherry-picked FAT related commits from upstream), but > I still get the same result.
I see. > Analyzing the code in fs/fat/fat.c:do_fat_read_at (which is called by > the fatls command) one can see that "ret" is set in three locations. > In my case I never reach any of these three, since my exit path is: > > fs/fat/fat.c: > > 1139 /* If end of rootdir reached */ > 1140 if (rootdir_end) { > 1141 if (dols == LS_ROOT) { > 1142 printf("\n%d file(s), %d dir(s)\n\n", > 1143 files, dirs); > 1144 *size = 0; > 1145 } > 1146 goto exit; > 1147 } OK... Understood. > So either this exit path is actually an error and it is correct as-is, > or this path should set "ret = 0". My knowledge of FAT is limited so I > can not really tell which it should be but there is no indications in > the code/comments that this exit path is an error. I think the exit is OK, as we have reached the end of the root directory, but it should set "ret = 0;" before the goto. But then, I am not an expert on this code either, so I added Sergei Shtylyov on cc: who added this line with commit ac4977719e157bcb3c45c70d9dd781164727530d Author: Sergei Shtylyov <sshtyl...@ru.mvista.com> Date: Mon Aug 8 09:38:33 2011 +0000 fat: fix crash with big sector size Sergei, do you agree that ret = 0 should be set before the "goto exit" here? Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de There is a biblical analogy I'd like to draw here. Casts are to C++ Programmers what the apple was to Eve. - Scott Douglas Meyers _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot