From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Thu, 03 Sep 2015 16:18:25 +0200 Subject: [U-Boot] [PATCH] FIX: fat: Provide correct return code from disk_{read|write} to upper layers In-Reply-To: <20150903154051.52436d8a@amdc2363> References: <1440769821-24005-2-git-send-email-l.majewski@samsung.com> <1441282899-13569-1-git-send-email-l.majewski@samsung.com> <20150903124409.GA26226@bill-the-cat> <20150903154051.52436d8a@amdc2363> Message-ID: <20150903161825.1d289255@amdc2363> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Lukasz, > Hi Tom, > > > On Thu, Sep 03, 2015 at 02:21:39PM +0200, Lukasz Majewski wrote: > > > > > It is very common that FAT code is using following pattern: > > > if (disk_{read|write}() < 0) > > > return -1; > > > > > > Up till now the above code was dead, since disk_{read|write) could > > > only return value >= 0. > > > As a result some errors from medium layer (i.e. eMMC/SD) were not > > > caught. > > > > > > The above behavior was caused by block_{read|write|erase} declared > > > at struct block_dev_desc (@part.h). It returns unsigned long, > > > where 0 indicates error and > 0 indicates that medium operation > > > was correct. > > > > > > This patch as error regards 0 returned from > > > block_{read|write|erase} when nr_blocks is grater than zero. > > > Read/Write operation with nr_blocks=0 should return 0 and hence > > > is not considered as an error. > > > > > > Signed-off-by: Lukasz Majewski > > > > > > Test HW: Odroid XU3 - Exynos 5433 > > > > Can you pick up Stephen's FAT replacement series and see if it also > > fixes this problem? Thanks! > > > > Ok, I will test this fat implementation. I've applied v2 of this patchset on top of SHA1: 79c884d7e449a63fa8f07b7495f8f9873355c48f Unfortunately, DFU tests fail with first attempt to pass the test. Apparently this code needs some more review/testing before being included to main line. > > However, since for v2015.10 it won't be included, I would also opt for > adding this fix to the current u-boot. > -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group