[U-Boot] [PATCH] mmc and fat bug fixes
Andy Fleming
afleming at gmail.com
Fri May 17 22:17:52 CEST 2013
On Thu, May 16, 2013 at 4:26 AM, Ruud Commandeur <RCommandeur at clb.nl> wrote:
> > Assuming this is necessary, I think it then might be time to
> > reorder this:
> >
> > if (!blkcnt) <-- possibly at the very start of the function.
> > return 0;
> >
> > if (blkcnt == 1)
> > cmd.cmdidx = MMC_CMD_WRITE_SINGLE_BLOCK;
> > else
> > cmd.cmdidx = MMC_CMD_WRITE_MULTIPLE_BLOCK;
> >
> >
> > While technically correct, checking >1, then >0 creates an
> > odd dissonance in my mind, and makes me have to think about
> > when that if clause will evaluate to true, and I hate having
> > to think. :)
> >
>
> You're right. That was the reason for adding my (wrong styled) comments.
> So I can either reorder his to:
>
> if (blkcnt == 0)
> return 0;
> else if (blkcnt == 1)
> cmd.cmdidx = MMC_CMD_WRITE_SINGLE_BLOCK;
> else
> cmd.cmdidx = MMC_CMD_WRITE_MULTIPLE_BLOCK;
>
> Or add the test for 0 at the very beginning as you suggested.
> Any preference?
>
>
This looks fine to me.
More information about the U-Boot
mailing list