Просмотр исходного кода

[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 8 лет назад
Родитель
Сommit
82bc90dd88
1 измененных файлов: 4 добавлений и 6 удалений
  1. 4
    6
      src/drivers/bus/usb.c

+ 4
- 6
src/drivers/bus/usb.c Просмотреть файл

@@ -1097,6 +1097,7 @@ usb_probe_all ( struct usb_device *usb,
1097 1097
 			   "%s-%d.%d", usb->name, config->config, first );
1098 1098
 		INIT_LIST_HEAD ( &func->dev.children );
1099 1099
 		func->dev.parent = bus->dev;
1100
+		list_add_tail ( &func->list, &usb->functions );
1100 1101
 
1101 1102
 		/* Identify function */
1102 1103
 		if ( ( rc = usb_function ( func, config, first ) ) != 0 )
@@ -1125,22 +1126,19 @@ usb_probe_all ( struct usb_device *usb,
1125 1126
 			       func->interface[i] );
1126 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 1129
 		/* Add to device hierarchy */
1132 1130
 		list_add_tail ( &func->dev.siblings, &bus->dev->children );
1133 1131
 
1134 1132
 		continue;
1135 1133
 
1136 1134
 		list_del ( &func->dev.siblings );
1137
-		list_del ( &func->list );
1138 1135
 		usb_remove ( func );
1139 1136
 	err_probe:
1140
-		free ( func );
1141
-	err_alloc:
1142 1137
 	err_interface:
1143 1138
 	err_function:
1139
+		list_del ( &func->list );
1140
+		free ( func );
1141
+	err_alloc:
1144 1142
 		/* Continue registering other functions */
1145 1143
 		continue;
1146 1144
 	}

Загрузка…
Отмена
Сохранить