mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [Bug 12592] New: fw_card_add adds card to the list even on enable failure
       [not found] ` <49857750.2010109@s5r6.in-berlin.de>
@ 2009-02-01 10:21   ` Stefan Richter
  0 siblings, 0 replies; only message in thread
From: Stefan Richter @ 2009-02-01 10:21 UTC (permalink / raw)
  To: linux1394-devel; +Cc: linux-kernel, Petr Vandrovec

Date: Sun,  1 Feb 2009 01:29:35 -0800 (PST)
From: Petr Vandrovec <petr@vandrovec.name>
Subject: 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>
---
 drivers/firewire/fw-card.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: linux/drivers/firewire/fw-card.c
===================================================================
--- linux.orig/drivers/firewire/fw-card.c
+++ linux/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);
 

-- 
Stefan Richter
-=====-==--= --=- ----=
http://arcgraph.de/sr/


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-01 10:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-12592-4803@http.bugzilla.kernel.org/>
     [not found] ` <49857750.2010109@s5r6.in-berlin.de>
2009-02-01 10:21   ` [Bug 12592] New: fw_card_add adds card to the list even on enable failure Stefan Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®