From: Bartlomiej Zolnierkiewicz Date: Sat, 5 Jul 2008 18:30:51 +0000 (+0200) Subject: ide: ide_unregister() warm-plug bugfix X-Git-Tag: v2.6.26-rc9~6^2~1 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd8a59e29726b2a5ff7baefe995febdc63044a61;p=linux-2.6 ide: ide_unregister() warm-plug bugfix Fix ide_unregister() to work for ports with no devices attached to them. Signed-off-by: Bartlomiej Zolnierkiewicz --- diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 246077792e..b31359c9fa 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -315,13 +315,14 @@ void ide_unregister(ide_hwif_t *hwif) BUG_ON(in_interrupt()); BUG_ON(irqs_disabled()); + mutex_lock(&ide_cfg_mtx); - spin_lock_irq(&ide_lock); - if (!hwif->present) - goto abort; - __ide_port_unregister_devices(hwif); - hwif->present = 0; + spin_lock_irq(&ide_lock); + if (hwif->present) { + __ide_port_unregister_devices(hwif); + hwif->present = 0; + } spin_unlock_irq(&ide_lock); ide_proc_unregister_port(hwif); @@ -359,7 +360,6 @@ void ide_unregister(ide_hwif_t *hwif) /* restore hwif data to pristine status */ ide_init_port_data(hwif, hwif->index); -abort: spin_unlock_irq(&ide_lock); mutex_unlock(&ide_cfg_mtx); }