All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: joseph daniel <josephdanielwalter@gmail.com>,
	devel@driverdev.osuosl.org,
	Florian Schilhabel <florian.c.schilhabel@googlemail.com>,
	linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: staging/rtl8712: unhandled default case in SwLedOn function.
Date: Thu, 3 May 2012 10:26:52 +0300	[thread overview]
Message-ID: <20120503072652.GA13252@mwanda> (raw)
In-Reply-To: <4FA19AE9.104@lwfinger.net>

> 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


      parent reply	other threads:[~2012-05-03  7:23 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
2012-05-03  3:35     ` joseph daniel
2012-05-03  7:26     ` Dan Carpenter [this message]

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=20120503072652.GA13252@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=Larry.Finger@lwfinger.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.