Browse Source

[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>
tags/v1.20.1
Piotr Jaroszyński 13 years ago
parent
commit
8ab2f51997
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      src/net/netdevice.c

+ 3
- 3
src/net/netdevice.c View File

@@ -463,13 +463,13 @@ int netdev_open ( struct net_device *netdev ) {
463 463
 
464 464
 	DBGC ( netdev, "NETDEV %s opening\n", netdev->name );
465 465
 
466
-	/* Mark as opened */
467
-	netdev->state |= NETDEV_OPEN;
468
-
469 466
 	/* Open the device */
470 467
 	if ( ( rc = netdev->op->open ( netdev ) ) != 0 )
471 468
 		return rc;
472 469
 
470
+	/* Mark as opened */
471
+	netdev->state |= NETDEV_OPEN;
472
+
473 473
 	/* Add to head of open devices list */
474 474
 	list_add ( &netdev->open_list, &open_net_devices );
475 475
 

Loading…
Cancel
Save