]> git.baikalelectronics.ru Git - kernel.git/commit
net: macb: Fix build warning
authorSoren Brinkmann <soren.brinkmann@xilinx.com>
Wed, 11 Dec 2013 04:57:57 +0000 (20:57 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Dec 2013 05:19:17 +0000 (00:19 -0500)
commite935aa066381056630490e6d5e53ef5b5be54319
treeccad60e27e3a1ecdd84785f4f26d201fef56fdaf
parent49342110e4009a8e827858860add10edf25d6c8c
net: macb: Fix build warning

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cadence/macb.c