public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Max Krummenacher <max.oss.09@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] spl: mmc: fix switch statement
Date: Sat, 15 Oct 2016 21:18:18 +0200	[thread overview]
Message-ID: <1476559098.2434.18.camel@gmail.com> (raw)
In-Reply-To: <8b898df5-1960-499d-9771-8a3b788f424f@denx.de>

Hi Marek

Am Samstag, den 15.10.2016, 19:29 +0200 schrieb Marek Vasut:
> On 10/15/2016 07:10 PM, Max Krummenacher wrote:
> > If CONFIG_SPL_LIBCOMMON_SUPPORT is not defined there is a lone case
> > statement
> > at the end of the switch leading to a compile error.
> > Remove the offending case statement.
> > 
> > > common/spl/spl_mmc.c:339:7: error: label at end of compound
> > > statement
> > 
> > Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
> > ---
> > 
> >  common/spl/spl_mmc.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
> > index c674e61..367b4e4 100644
> > --- a/common/spl/spl_mmc.c
> > +++ b/common/spl/spl_mmc.c
> > @@ -342,7 +342,6 @@ static int spl_mmc_load_image(struct
> > spl_image_info *spl_image,
> >  			return err;
> >  
> >  		break;
> > -	case MMCSD_MODE_UNDEFINED:
> 
> This patch is wrong -- in case CONFIG_SPL_LIBCOMMON_SUPPORT is
> enabled
> and mode is MMCSD_MODE_UNDEFINED, the message in the puts() below
> would
> be printed. After applying this change, the message won't be printed


I disagree.

With CONFIG_SPL_LIBCOMMON_SUPPORT we had something like this:
switch(bar) {
...
case foo:
default:
	put("bla\n");
}

as 'case foo:' falls through into 'default:' removing the specific case
does not change anything.

Regards
Max


> The fix is probably something like:
> 
> case foo:
> default:
> #ifdef CONFIG_BAR
>     puts();
> #endif
>     break;
> 
> >  #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
> >  	default:
> >  		puts("spl: mmc: wrong boot mode\n");
> > 
> 

  reply	other threads:[~2016-10-15 19:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-15 17:10 [U-Boot] [PATCH 1/3] spl: mmc: fix switch statement Max Krummenacher
2016-10-15 17:10 ` [U-Boot] [PATCH 2/3] imx: make ipu's di configurable Max Krummenacher
2016-10-15 17:10 ` [U-Boot] [PATCH 3/3] mx6: synchronize SPL to u-boot offset Max Krummenacher
2016-10-15 17:30   ` Marek Vasut
2016-10-15 19:17     ` Max Krummenacher
2016-10-15 19:27       ` Marek Vasut
2016-10-17 12:28         ` Max Krummenacher
2016-10-17 12:45           ` Marek Vasut
2016-10-17 15:24             ` Max Krummenacher
2016-10-15 17:29 ` [U-Boot] [PATCH 1/3] spl: mmc: fix switch statement Marek Vasut
2016-10-15 19:18   ` Max Krummenacher [this message]
2016-10-15 19:31     ` Marek Vasut
2016-10-16 11:49 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476559098.2434.18.camel@gmail.com \
    --to=max.oss.09@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox