lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120503072652.GA13252@mwanda>
Date:	Thu, 3 May 2012 10:26:52 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Larry Finger <Larry.Finger@...inger.net>
Cc:	joseph daniel <josephdanielwalter@...il.com>,
	devel@...verdev.osuosl.org,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	linux-kernel@...r.kernel.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: staging/rtl8712: unhandled default case in SwLedOn function.

> 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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ