summaryrefslogtreecommitdiffstats
path: root/src/net/netdevice.c
diff options
context:
space:
mode:
authorPiotr JaroszyƄski2011-03-27 19:26:28 +0200
committerMichael Brown2011-03-27 19:59:13 +0200
commit8ab2f51997db80c88d098844ad5a9af5736d1c9e (patch)
treeb37c86f1d4a34f8c9e9054ca59a0fcf35454c038 /src/net/netdevice.c
parent[settings] Add "read" command (diff)
downloadipxe-8ab2f51997db80c88d098844ad5a9af5736d1c9e.tar.gz
ipxe-8ab2f51997db80c88d098844ad5a9af5736d1c9e.tar.xz
ipxe-8ab2f51997db80c88d098844ad5a9af5736d1c9e.zip
[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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c
index 81382376..30173817 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 );