summaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorPetr Vandrovec <petr@vandrovec.name>2009-02-01 01:29:35 -0800
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-02-01 11:17:24 +0100
commitb7479febdecf8e12951aecb0b405e4655aa3dae6 (patch)
treeccc9c5c692a6e515194a190d9efd184faa610a1e /drivers/firewire
parent1448d7c6a2ff96d3b52ecae49e2d0f046a097fe0 (diff)
downloadop-kernel-dev-b7479febdecf8e12951aecb0b405e4655aa3dae6.zip
op-kernel-dev-b7479febdecf8e12951aecb0b405e4655aa3dae6.tar.gz
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')
-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 7be2cf3..a5dd7a6 100644
--- a/drivers/firewire/fw-card.c
+++ b/drivers/firewire/fw-card.c
@@ -412,6 +412,7 @@ fw_card_add(struct fw_card *card,
{
u32 *config_rom;
size_t length;
+ int err;
card->max_receive = max_receive;
card->link_speed = link_speed;
@@ -422,7 +423,13 @@ fw_card_add(struct fw_card *card,
list_add_tail(&card->link, &card_list);
mutex_unlock(&card_mutex);
- return card->driver->enable(card, config_rom, length);
+ err = card->driver->enable(card, config_rom, length);
+ if (err < 0) {
+ mutex_lock(&card_mutex);
+ list_del(&card->link);
+ mutex_unlock(&card_mutex);
+ }
+ return err;
}
EXPORT_SYMBOL(fw_card_add);
OpenPOWER on IntegriCloud