[PATCH] IDE: Unregister devices if initialization fails.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux