lkml.org 
[lkml]   [2012]   [May]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: staging/rtl8712: unhandled default case in SwLedOn function.
From
On Thu, May 3, 2012 at 2:36 AM, Larry Finger <Larry.Finger@lwfinger.net> wrote:
> On 05/02/2012 03:12 PM, joseph daniel wrote:
>>
>> On Thu, May 3, 2012 at 2:10 AM, joseph daniel
>> <josephdanielwalter@gmail.com>  wrote:
>>>
>>> Hi kernel developers,
>>>
>>> In the function SwLedOn in rtl8712_led.c, we put the bLedOn = true,
>>> even if its a default case. may be we need to return? or BUG()?.
>>>
>>> the code listing is:
>>>
>>> if ((padapter->bSurpriseRemoved == true) ||
>>>        (padapter->bDriverStopped == true))
>>>        return;
>>>    LedCfg = r8712_read8(padapter, LEDCFG);
>>>    switch (pLed->LedPin) {
>>>    case LED_PIN_GPIO0:
>>>        break;
>>>    case LED_PIN_LED0:
>>>        /* SW control led0 on.*/
>>>        r8712_write8(padapter, LEDCFG, LedCfg&0xf0);
>>>        break;
>>>    case LED_PIN_LED1:
>>>        /* SW control led1 on.*/
>>>        r8712_write8(padapter, LEDCFG, LedCfg&0x0f);
>>>        break;
>>>    default:
>>
>> /* at this point of the code */
>>>
>>>       /* break; */
>>
>>          return; /* or */
>>          /* BUG(); */ /*since we may not be getting into here */
>>>
>>>    }
>>>    pLed->bLedOn = true;
>>>
>
> This should do:
>
> Index: staging/drivers/staging/rtl8712/rtl8712_led.c
> ===================================================================
> --- staging.orig/drivers/staging/rtl8712/rtl8712_led.c
> +++ staging/drivers/staging/rtl8712/rtl8712_led.c
> @@ -137,7 +137,8 @@ static void SwLedOn(struct _adapter *pad
>
>                r8712_write8(padapter, LEDCFG, LedCfg&0x0f);
>                break;
>        default:
> -               break;
> +               WARN_ONCE(1, "Default branch taken in %s\n", __func__);
> +               return;
>        }
>        pLed->bLedOn = true;
>  }
>
> If you agree, then I will push the patch to Greg.
>
Agreed. Thanks Greg and Larry.
Acked-by: josephdanielwalter@gmail.com

> Larry


Thanks,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-05-03 05:41    [W:0.045 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site