Hi, Dear Wolfgang Denk

On 7/19/2013 7:20 PM, Wolfgang Denk wrote:
Dear Josh Wu,

In message <51e90a3d.6000...@atmel.com> you wrote:
Why would this be needed?  The case of a partial write is covered
further down below in the code, in the "if (size % mydata->sect_size)"
part...
The call of disk_write() will pass the sector size as 0. That will cause
the mmc driver stalled.
I think instead of "sector size" you mean the number of sectors.  The
sector size is fixed.

yes, I mean the number of sectors.


Big question: why should we call disk_write() at all when the count is
zero? Maybe a simple

        if ((size / mydata->sect_size) > 0) {
                if (disk_write(startsect, size / mydata->sect_size, buffer) < 
0) {
                        ...
                }
        }

would fix this issue?

I agree with above changes. It make the logical clearer:
Step 1. write buffer in sectors. If buffer size is less than one sector we don't need to call disk_write() with zero sector.
   Step 2. write remain buffer in one sector.

So I think I will send a v2 patch according to your suggestion. Thanks.



Best regards,

Wolfgang Denk


Best Regards,
Josh Wu
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to