@@ -490,7 +490,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
490
490
{
491
491
struct net_device * netdev = fcoe -> netdev ;
492
492
struct fcoe_ctlr * fip = fcoe_to_ctlr (fcoe );
493
- struct fcoe_ctlr_device * ctlr_dev = fcoe_ctlr_to_ctlr_dev (fip );
494
493
495
494
rtnl_lock ();
496
495
if (!fcoe -> removed )
@@ -501,7 +500,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
501
500
/* tear-down the FCoE controller */
502
501
fcoe_ctlr_destroy (fip );
503
502
scsi_host_put (fip -> lp -> host );
504
- fcoe_ctlr_device_delete (ctlr_dev );
505
503
dev_put (netdev );
506
504
module_put (THIS_MODULE );
507
505
}
@@ -2194,6 +2192,8 @@ static int fcoe_destroy(struct net_device *netdev)
2194
2192
*/
2195
2193
static void fcoe_destroy_work (struct work_struct * work )
2196
2194
{
2195
+ struct fcoe_ctlr_device * cdev ;
2196
+ struct fcoe_ctlr * ctlr ;
2197
2197
struct fcoe_port * port ;
2198
2198
struct fcoe_interface * fcoe ;
2199
2199
struct Scsi_Host * shost ;
@@ -2224,10 +2224,15 @@ static void fcoe_destroy_work(struct work_struct *work)
2224
2224
mutex_lock (& fcoe_config_mutex );
2225
2225
2226
2226
fcoe = port -> priv ;
2227
+ ctlr = fcoe_to_ctlr (fcoe );
2228
+ cdev = fcoe_ctlr_to_ctlr_dev (ctlr );
2229
+
2227
2230
fcoe_if_destroy (port -> lport );
2228
2231
fcoe_interface_cleanup (fcoe );
2229
2232
2230
2233
mutex_unlock (& fcoe_config_mutex );
2234
+
2235
+ fcoe_ctlr_device_delete (cdev );
2231
2236
}
2232
2237
2233
2238
/**
@@ -2335,7 +2340,9 @@ static int _fcoe_create(struct net_device *netdev, enum fip_state fip_mode,
2335
2340
rc = - EIO ;
2336
2341
rtnl_unlock ();
2337
2342
fcoe_interface_cleanup (fcoe );
2338
- goto out_nortnl ;
2343
+ mutex_unlock (& fcoe_config_mutex );
2344
+ fcoe_ctlr_device_delete (ctlr_dev );
2345
+ goto out ;
2339
2346
}
2340
2347
2341
2348
/* Make this the "master" N_Port */
@@ -2375,8 +2382,8 @@ static int _fcoe_create(struct net_device *netdev, enum fip_state fip_mode,
2375
2382
2376
2383
out_nodev :
2377
2384
rtnl_unlock ();
2378
- out_nortnl :
2379
2385
mutex_unlock (& fcoe_config_mutex );
2386
+ out :
2380
2387
return rc ;
2381
2388
}
2382
2389
0 commit comments