aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-card.c
diff options
context:
space:
mode:
authorPetr Vandrovec <petr@vandrovec.name>2009-02-01 04:29:35 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-02-01 05:17:24 -0500
commitb7479febdecf8e12951aecb0b405e4655aa3dae6 (patch)
treeccc9c5c692a6e515194a190d9efd184faa610a1e /drivers/firewire/fw-card.c
parent1448d7c6a2ff96d3b52ecae49e2d0f046a097fe0 (diff)
firewire: core: Remove card from list of cards when enable fails
Signed-off-by: Petr Vandrovec <petr@vandrovec.name> After a controller initialization failure, addition of another card got stuck due to card_list corruption. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-card.c')
-rw-r--r--drivers/firewire/fw-card.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c
index 7be2cf3514e7..a5dd7a665aa8 100644
--- a/drivers/firewire/fw-card.c
+++ b/drivers/firewire/fw-card.c
@@ -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