diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 482f41f3f15ebd0680752526809294460359b5fb..6d57b7cd54245651d616f90ec7ffc49643dea1b1 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -39,8 +39,6 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
-static ide_hwif_t ide_hwifs[MAX_HWIFS]; /* master data repository */
-
 /**
  *	generic_id		-	add a generic drive id
  *	@drive:	drive to make an ID block for
@@ -1583,15 +1581,18 @@ struct ide_host *ide_host_alloc_all(const struct ide_port_info *d,
 		if (hws[i] == NULL)
 			continue;
 
+		hwif = kzalloc(sizeof(*hwif), GFP_KERNEL);
+		if (hwif == NULL)
+			continue;
+
 		idx = ide_find_port_slot(d);
 		if (idx < 0) {
 			printk(KERN_ERR "%s: no free slot for interface\n",
 					d ? d->name : "ide");
+			kfree(hwif);
 			continue;
 		}
 
-		hwif = &ide_hwifs[idx];
-
 		ide_init_port_data(hwif, idx);
 
 		host->ports[i] = hwif;
@@ -1755,6 +1756,7 @@ void ide_host_remove(struct ide_host *host)
 
 		ide_unregister(hwif);
 		ide_free_port_slot(hwif->index);
+		kfree(hwif);
 	}
 
 	kfree(host);
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 60c5db1c59e55b56f6de5dcf4c2c9ec27fa3f878..914942a766db15f39d185871220c87555d963de2 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -233,11 +233,6 @@ void ide_unregister(ide_hwif_t *hwif)
 	if (hwif->dma_base)
 		ide_release_dma_engine(hwif);
 
-	spin_lock_irq(&ide_lock);
-	/* restore hwif data to pristine status */
-	ide_init_port_data(hwif, hwif->index);
-	spin_unlock_irq(&ide_lock);
-
 	mutex_unlock(&ide_cfg_mtx);
 }