]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[netdevice] Mark devices as open only if opening succeeds
authorPiotr Jaroszyński <p.jaroszynski@gmail.com>
Sun, 27 Mar 2011 17:26:28 +0000 (19:26 +0200)
committerMichael Brown <mcb30@ipxe.org>
Sun, 27 Mar 2011 17:59:13 +0000 (18:59 +0100)
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>
src/net/netdevice.c

index 8138237608ad0b4228ace14518ee18d3ed69a74f..301738173b09a2fa599d362436ed3608bc85c296 100644 (file)
@@ -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 );