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

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

 



> 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;
>  }
> 

Don't just reflexively add extra debug code.

In this case pLed->LedPin is either LED_PIN_LED0 or LED_PIN_LED1.
The LED_PIN_GPIO0 and default cases are never used.  Even if it were
I think we would want to set pLed->bLedOn = true in the default
case.

The code is ugly as pants, but it works fine as is.

regards,
dan carpenter

_______________________________________________
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