linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IDE: Unregister devices if initialization fails.
@ 2009-01-23 13:04 Ian Campbell
  2009-01-27 16:41 ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Campbell @ 2009-01-23 13:04 UTC (permalink / raw)
  To: linux-ide; +Cc: Ian Campbell, Ian Campbell, Bartlomiej Zolnierkiewicz

On reboot the loop in device_shutdown gets confused by these devices
and goes into an infinite loop. I think this is because they don't
have dev->bus or dev->driver which is because hwif_register_devices
doesn't get called if !hwif->present.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-probe.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 312127e..120f65b 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1520,6 +1520,8 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
 		if (hwif_init(hwif) == 0) {
 			printk(KERN_INFO "%s: failed to initialize IDE "
 					 "interface\n", hwif->name);
+			device_unregister(&hwif->gendev);
+			device_destroy(ide_port_class, MKDEV(0, 0));
 			hwif->present = 0;
 			continue;
 		}
@@ -1550,11 +1552,11 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
 		if (hwif == NULL)
 			continue;
 
-		ide_sysfs_register_port(hwif);
-		ide_proc_register_port(hwif);
-
-		if (hwif->present)
+		if (hwif->present) {
+			ide_sysfs_register_port(hwif);
+			ide_proc_register_port(hwif);
 			ide_proc_port_register_devices(hwif);
+		}
 	}
 
 	return j ? 0 : -1;
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-02-02 18:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-23 13:04 [PATCH] IDE: Unregister devices if initialization fails Ian Campbell
2009-01-27 16:41 ` Bartlomiej Zolnierkiewicz
2009-01-30 17:19   ` Ian Campbell
2009-02-01 16:21     ` Bartlomiej Zolnierkiewicz
2009-02-02 10:09       ` Ian Campbell
2009-02-02 17:49         ` Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).