]> git.baikalelectronics.ru Git - kernel.git/commit
usb: gadget: Fix g_ether interface link status
authorKevin Cernekee <cernekee@gmail.com>
Mon, 25 Jun 2012 04:11:22 +0000 (21:11 -0700)
committerFelipe Balbi <balbi@ti.com>
Mon, 25 Jun 2012 11:14:42 +0000 (14:14 +0300)
commit42808d1f125b5f338e67a6308f6ad6e92dab90a3
tree966465924ccc16cb5c774dd3551413a9acdda4d9
parent19ee49b3d3db9eebea05ab8f03af7f4beb3543bd
usb: gadget: Fix g_ether interface link status

A "usb0" interface that has never been connected to a host has an unknown
operstate, and therefore the IFF_RUNNING flag is (incorrectly) asserted
when queried by ifconfig, ifplugd, etc.  This is a result of calling
netif_carrier_off() too early in the probe function; it should be called
after register_netdev().

Similar problems have been fixed in many other drivers, e.g.:

    ea2272dbf (bonding: Call netif_carrier_off after register_netdevice)
    a5da57e51 (drivers/net: Call netif_carrier_off at the end of the probe)
    4f8419be7 (cxgb4: fix reported state of interfaces without link)

Fix is to move netif_carrier_off() to the end of the function.

Cc: stable@vger.kernel.org
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/u_ether.c