public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: joseph daniel <josephdanielwalter@gmail.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Florian Schilhabel <florian.c.schilhabel@googlemail.com>,
	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, 2 May 2012 13:20:31 -0700	[thread overview]
Message-ID: <20120502202031.GA26628@kroah.com> (raw)
In-Reply-To: <CAFDqYy03M7aZBzz30fT590YsLvZsm6JorXBGZ1CwJg2Qp01UOQ@mail.gmail.com>

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@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 */

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

thanks,

greg k-h

  reply	other threads:[~2012-05-02 20:20 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 [this message]
2012-05-02 20:36   ` Larry Finger
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=20120502202031.GA26628@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=ali@internetdog.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=florian.c.schilhabel@googlemail.com \
    --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