diff options
author | Piotr JaroszyĆski <p.jaroszynski@gmail.com> | 2011-03-27 19:26:28 +0200 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2011-03-27 18:59:13 +0100 |
commit | 8ab2f51997db80c88d098844ad5a9af5736d1c9e (patch) | |
tree | b37c86f1d4a34f8c9e9054ca59a0fcf35454c038 /src/net/netdevice.c | |
parent | 1cc991e132bcd98f8e93dcc138e5a74d5a0402df (diff) | |
download | ipxe-8ab2f51997db80c88d098844ad5a9af5736d1c9e.tar.gz |
[netdevice] Mark devices as open only if opening succeeds
netdev_close() assumes that devices that are open are on the
open_list, which wasn't true if device specific opening failed.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/netdevice.c')
-rw-r--r-- | src/net/netdevice.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c index 813823760..301738173 100644 --- a/src/net/netdevice.c +++ b/src/net/netdevice.c @@ -463,13 +463,13 @@ int netdev_open ( struct net_device *netdev ) { DBGC ( netdev, "NETDEV %s opening\n", netdev->name ); - /* Mark as opened */ - netdev->state |= NETDEV_OPEN; - /* Open the device */ if ( ( rc = netdev->op->open ( netdev ) ) != 0 ) return rc; + /* Mark as opened */ + netdev->state |= NETDEV_OPEN; + /* Add to head of open devices list */ list_add ( &netdev->open_list, &open_net_devices ); |