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>

authored by Petr Vandrovec and committed by Stefan Richter b7479feb 1448d7c6

+8 -1
+8 -1
drivers/firewire/fw-card.c
··· 412 { 413 u32 *config_rom; 414 size_t length; 415 416 card->max_receive = max_receive; 417 card->link_speed = link_speed; ··· 423 list_add_tail(&card->link, &card_list); 424 mutex_unlock(&card_mutex); 425 426 - return card->driver->enable(card, config_rom, length); 427 } 428 EXPORT_SYMBOL(fw_card_add); 429
··· 412 { 413 u32 *config_rom; 414 size_t length; 415 + int err; 416 417 card->max_receive = max_receive; 418 card->link_speed = link_speed; ··· 422 list_add_tail(&card->link, &card_list); 423 mutex_unlock(&card_mutex); 424 425 + err = card->driver->enable(card, config_rom, length); 426 + if (err < 0) { 427 + mutex_lock(&card_mutex); 428 + list_del(&card->link); 429 + mutex_unlock(&card_mutex); 430 + } 431 + return err; 432 } 433 EXPORT_SYMBOL(fw_card_add); 434