Re: staging/rtl8712: unhandled default case in SwLedOn function.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 03, 2012 at 02:12:39AM +0600, joseph daniel wrote:
> On Thu, May 3, 2012 at 2:10 AM, joseph daniel
> <josephdanielwalter@xxxxxxxxx> 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 */

Never crash the kernel in a driver, that's just rude.  Error out
properly if something unexpected happens.

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux