public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: joseph daniel <josephdanielwalter@gmail.com>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ali Bahar <ali@internetdog.org>,
	linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org
Subject: Re: staging/rtl8712: unhandled default case in SwLedOn function.
Date: Wed, 02 May 2012 15:36:57 -0500	[thread overview]
Message-ID: <4FA19AE9.104@lwfinger.net> (raw)
In-Reply-To: <CAFDqYy03M7aZBzz30fT590YsLvZsm6JorXBGZ1CwJg2Qp01UOQ@mail.gmail.com>

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.

Larry

  parent reply	other threads:[~2012-05-02 20:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-02 20:10 staging/rtl8712: unhandled default case in SwLedOn function joseph daniel
2012-05-02 20:12 ` joseph daniel
2012-05-02 20:20   ` Greg Kroah-Hartman
2012-05-02 20:36   ` Larry Finger [this message]
2012-05-03  3:35     ` joseph daniel
2012-05-03  7:26     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FA19AE9.104@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=ali@internetdog.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=florian.c.schilhabel@googlemail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=josephdanielwalter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox