Re: [U-Boot] [PATCH 1/3] spl: mmc: fix switch statement

2016-10-16 Thread Tom Rini
On Sat, Oct 15, 2016 at 07:10:14PM +0200, 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 

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] spl: mmc: fix switch statement

2016-10-15 Thread Marek Vasut
On 10/15/2016 09:18 PM, Max Krummenacher wrote:
> 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 
>>> ---
>>>
>>>  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.

Oh, that's a good point, I missed that and that's in fact pretty elegant
fix. Thanks.

Acked-by: Marek Vasut 

[...]
-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] spl: mmc: fix switch statement

2016-10-15 Thread Max Krummenacher
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 
> > ---
> > 
> >  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");
> > 
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] spl: mmc: fix switch statement

2016-10-15 Thread 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 
> ---
> 
>  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 .

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");
> 


-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot