net/at91_ether: avoid NULL pointer dereference
authorGilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Sun, 6 Apr 2014 18:37:44 +0000 (20:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Apr 2014 13:50:04 +0000 (06:50 -0700)
commit661f2c959342dd73e679adba75b2f8ddbe276981
treec20701d0ae8c8ffa7594b4bab76154ec9d475596
parenteb3d1ebaa77c257872264015644f182c7888c021
net/at91_ether: avoid NULL pointer dereference

[ Upstream commit c293fb785bdda64d88f197e6758a3c16ae83e569 ]

The at91_ether driver calls macb_mii_init passing a 'struct macb'
structure whose tx_clk member is initialized to 0. However,
macb_handle_link_change() expects tx_clk to be the result of
a call to clk_get, and so IS_ERR(tx_clk) to be true if the clock
is invalid. This causes an oops when booting Linux 3.14 on the
csb637 board. The following changes avoids this.

Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/cadence/at91_ether.c