aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-card.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/fw-card.c')
-rw-r--r--drivers/firewire/fw-card.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c
index 6bd91a15d5e6..a5dd7a665aa8 100644
--- a/drivers/firewire/fw-card.c
+++ b/drivers/firewire/fw-card.c
@@ -232,7 +232,7 @@ fw_card_bm_work(struct work_struct *work)
232 root_id = root_node->node_id; 232 root_id = root_node->node_id;
233 grace = time_after(jiffies, card->reset_jiffies + DIV_ROUND_UP(HZ, 10)); 233 grace = time_after(jiffies, card->reset_jiffies + DIV_ROUND_UP(HZ, 10));
234 234
235 if (card->bm_generation + 1 == generation || 235 if (is_next_generation(generation, card->bm_generation) ||
236 (card->bm_generation != generation && grace)) { 236 (card->bm_generation != generation && grace)) {
237 /* 237 /*
238 * This first step is to figure out who is IRM and 238 * This first step is to figure out who is IRM and
@@ -412,6 +412,7 @@ fw_card_add(struct fw_card *card,
412{ 412{
413 u32 *config_rom; 413 u32 *config_rom;
414 size_t length; 414 size_t length;
415 int err;
415 416
416 card->max_receive = max_receive; 417 card->max_receive = max_receive;
417 card->link_speed = link_speed; 418 card->link_speed = link_speed;
@@ -422,7 +423,13 @@ fw_card_add(struct fw_card *card,
422 list_add_tail(&card->link, &card_list); 423 list_add_tail(&card->link, &card_list);
423 mutex_unlock(&card_mutex); 424 mutex_unlock(&card_mutex);
424 425
425 return card->driver->enable(card, config_rom, length); 426 err = card->driver->enable(card, config_rom, length);
427 if (err < 0) {
428 mutex_lock(&card_mutex);
429 list_del(&card->link);
430 mutex_unlock(&card_mutex);
431 }
432 return err;
426} 433}
427EXPORT_SYMBOL(fw_card_add); 434EXPORT_SYMBOL(fw_card_add);
428 435
@@ -512,7 +519,7 @@ fw_core_remove_card(struct fw_card *card)
512 fw_core_initiate_bus_reset(card, 1); 519 fw_core_initiate_bus_reset(card, 1);
513 520
514 mutex_lock(&card_mutex); 521 mutex_lock(&card_mutex);
515 list_del(&card->link); 522 list_del_init(&card->link);
516 mutex_unlock(&card_mutex); 523 mutex_unlock(&card_mutex);
517 524
518 /* Set up the dummy driver. */ 525 /* Set up the dummy driver. */