Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd8a59e2 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

ide: ide_unregister() warm-plug bugfix



Fix ide_unregister() to work for ports with no devices attached to them.

Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 7cd95f56
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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;
	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);
}