public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre@atmel•com>
To: Soren Brinkmann <soren.brinkmann@xilinx•com>,
	David Miller <davem@davemloft•net>
Cc: <linux-kernel@vger•kernel.org>, <netdev@vger•kernel.org>,
	"kbuild test robot" <fengguang.wu@intel•com>
Subject: Re: [PATCH] net: macb: Fix build warning
Date: Wed, 11 Dec 2013 09:07:44 +0100	[thread overview]
Message-ID: <52A81D50.8080805@atmel.com> (raw)
In-Reply-To: <1386737877-16531-1-git-send-email-soren.brinkmann@xilinx.com>

On 11/12/2013 05:57, Soren Brinkmann :
> When adjusting the link speed, the target frequency is determined by a
> 'swith (LINK_SPEED)' statement, that assigns the target rate only for
> valid and expected LINK_SPEED values. This incomplete switch statement
> leads to the following build warning:
>       drivers/net/ethernet/cadence/macb.c: In function 'macb_handle_link_change':
>    >> drivers/net/ethernet/cadence/macb.c:241:14: warning: 'rate' may be used uninitialized in this function [-Wmaybe-uninitialized]
>          netdev_warn(dev, "unable to generate target frequency: %ld Hz\n",
>                     ^
>       drivers/net/ethernet/cadence/macb.c:215:13: note: 'rate' was declared here
>         long ferr, rate, rate_rounded;
>
> Fixing this by bailing out of that function in the switch's default case
> before the rate variable is used.
>
> Reported-by: kbuild test robot <fengguang.wu@intel•com>
> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx•com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel•com>

> ---
>   drivers/net/ethernet/cadence/macb.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
> index 419529a9309d..3190d38e16fb 100644
> --- a/drivers/net/ethernet/cadence/macb.c
> +++ b/drivers/net/ethernet/cadence/macb.c
> @@ -225,7 +225,7 @@ static void macb_set_tx_clk(struct clk *clk, int speed, struct net_device *dev)
>   		rate = 125000000;
>   		break;
>   	default:
> -		break;
> +		return;
>   	}
>
>   	rate_rounded = clk_round_rate(clk, rate);
>


-- 
Nicolas Ferre

      reply	other threads:[~2013-12-11  8:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11  4:57 [PATCH] net: macb: Fix build warning Soren Brinkmann
2013-12-11  8:07 ` Nicolas Ferre [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=52A81D50.8080805@atmel.com \
    --to=nicolas.ferre@atmel$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=fengguang.wu@intel$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=soren.brinkmann@xilinx$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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