From: Tom Rini Date: Wed, 18 Nov 2015 17:33:48 -0500 Subject: [U-Boot] [U-Boot, V4, 02/13] spl: mmc: add break statements in spl_mmc_load_image() In-Reply-To: <1446995514-26357-3-git-send-email-nikita@compulab.co.il> References: <1446995514-26357-3-git-send-email-nikita@compulab.co.il> Message-ID: <20151118223348.GI8060@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sun, Nov 08, 2015 at 05:11:43PM +0200, Nikita Kiryanov wrote: > The original intention of the mmc load_image() function was to try multiple > boot modes before failing. This is evident by the lack of break statements > in the switch, and the following line in the default case: > puts("spl: mmc: no boot mode left to try\n"); > > This implementation is problematic because: > - The availability of alternative boot modes is very arbitrary since it > depends on the specific order of the switch cases. If your boot mode happens to > be the first case, then you'll have a bunch of other boot modes as alternatives. > If it happens to be the last case, then you have none. > - Opting in/out is tied to config options, so the only way for you to prevent an > alternative boot mode from being attempted is to give up on the feature completely. > - This implementation makes the code more complicated and difficult to > understand. > > Address these issues by inserting a break statements between the cases to make the > function try only one boot mode. > > Signed-off-by: Nikita Kiryanov > Cc: Igor Grinberg > Cc: Paul Kocialkowski > Cc: Pantelis Antoniou > Cc: Tom Rini > Cc: Simon Glass > Reviewed-by: Simon Glass > Reviewed-by: Tom Rini Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: