Browse Source

[usb] Add function to device's function list before attempting probe

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
82bc90dd88
1 changed files with 4 additions and 6 deletions
  1. 4
    6
      src/drivers/bus/usb.c

+ 4
- 6
src/drivers/bus/usb.c View File

1097
 			   "%s-%d.%d", usb->name, config->config, first );
1097
 			   "%s-%d.%d", usb->name, config->config, first );
1098
 		INIT_LIST_HEAD ( &func->dev.children );
1098
 		INIT_LIST_HEAD ( &func->dev.children );
1099
 		func->dev.parent = bus->dev;
1099
 		func->dev.parent = bus->dev;
1100
+		list_add_tail ( &func->list, &usb->functions );
1100
 
1101
 
1101
 		/* Identify function */
1102
 		/* Identify function */
1102
 		if ( ( rc = usb_function ( func, config, first ) ) != 0 )
1103
 		if ( ( rc = usb_function ( func, config, first ) ) != 0 )
1125
 			       func->interface[i] );
1126
 			       func->interface[i] );
1126
 		DBGC ( usb, " using driver %s\n", func->dev.driver_name );
1127
 		DBGC ( usb, " using driver %s\n", func->dev.driver_name );
1127
 
1128
 
1128
-		/* Add to list of functions */
1129
-		list_add ( &func->list, &usb->functions );
1130
-
1131
 		/* Add to device hierarchy */
1129
 		/* Add to device hierarchy */
1132
 		list_add_tail ( &func->dev.siblings, &bus->dev->children );
1130
 		list_add_tail ( &func->dev.siblings, &bus->dev->children );
1133
 
1131
 
1134
 		continue;
1132
 		continue;
1135
 
1133
 
1136
 		list_del ( &func->dev.siblings );
1134
 		list_del ( &func->dev.siblings );
1137
-		list_del ( &func->list );
1138
 		usb_remove ( func );
1135
 		usb_remove ( func );
1139
 	err_probe:
1136
 	err_probe:
1140
-		free ( func );
1141
-	err_alloc:
1142
 	err_interface:
1137
 	err_interface:
1143
 	err_function:
1138
 	err_function:
1139
+		list_del ( &func->list );
1140
+		free ( func );
1141
+	err_alloc:
1144
 		/* Continue registering other functions */
1142
 		/* Continue registering other functions */
1145
 		continue;
1143
 		continue;
1146
 	}
1144
 	}

Loading…
Cancel
Save