linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix crash on boot in kmalloc_node IDE changes
@ 2005-07-06 13:30 Andi Kleen
  2005-07-06 14:05 ` Bartlomiej Zolnierkiewicz
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Andi Kleen @ 2005-07-06 13:30 UTC (permalink / raw)
  To: linux-ide, torvalds, linux-kernel, christoph


Without this patch a dual Xeon EM64T machine would oops on boot
because the hwif pointer here was NULL. I also added a check for
pci_dev because it's doubtful that all IDE devices have pci_devs.

Signed-off-by: Andi Kleen <ak@suse.de>


Index: linux/drivers/ide/ide-probe.c
===================================================================
--- linux.orig/drivers/ide/ide-probe.c
+++ linux/drivers/ide/ide-probe.c
@@ -978,8 +978,10 @@ static int ide_init_queue(ide_drive_t *d
 	 *	do not.
 	 */
 
-	q = blk_init_queue_node(do_ide_request, &ide_lock,
-				pcibus_to_node(drive->hwif->pci_dev->bus));
+	int node = 0; /* Should be -1 */
+	if (drive->hwif && drive->hwif->pci_dev)
+		node = pcibus_to_node(drive->hwif->pci_dev->bus); 
+	q = blk_init_queue_node(do_ide_request, &ide_lock, node);
 	if (!q)
 		return 1;
 
@@ -1096,8 +1098,13 @@ static int init_irq (ide_hwif_t *hwif)
 		hwgroup->hwif->next = hwif;
 		spin_unlock_irq(&ide_lock);
 	} else {
-		hwgroup = kmalloc_node(sizeof(ide_hwgroup_t), GFP_KERNEL,
-			pcibus_to_node(hwif->drives[0].hwif->pci_dev->bus));
+		int node = 0; 
+		if (hwif->drives[0].hwif) { 
+			struct pci_dev *pdev = hwif->drives[0].hwif->pci_dev;  
+			if (pdev)
+				node = pcibus_to_node(pdev->bus);
+		}
+		hwgroup = kmalloc_node(sizeof(ide_hwgroup_t), GFP_KERNEL,node);
 		if (!hwgroup)
 	       		goto out_up;
 



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

end of thread, other threads:[~2005-07-08  4:44 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-06 13:30 [PATCH] Fix crash on boot in kmalloc_node IDE changes Andi Kleen
2005-07-06 14:05 ` Bartlomiej Zolnierkiewicz
2005-07-06 14:09   ` Andi Kleen
2005-07-06 14:35     ` Bartlomiej Zolnierkiewicz
2005-07-06 18:21       ` Andi Kleen
2005-07-06 16:34 ` Christoph Lameter
2005-07-06 16:45   ` Andi Kleen
2005-07-06 17:07     ` Christoph Lameter
2005-07-07 16:21 ` [another PATCH] " Christoph Lameter
2005-07-07 16:24   ` Andi Kleen
2005-07-07 16:32     ` Christoph Lameter
2005-07-07 16:36       ` Andi Kleen
2005-07-07 17:15         ` Christoph Lameter
2005-07-07 16:46       ` Bartlomiej Zolnierkiewicz
2005-07-07 16:38   ` Linus Torvalds
2005-07-07 16:40     ` Andi Kleen
2005-07-07 17:23     ` Christoph Lameter
2005-07-07 17:31       ` Jens Axboe
2005-07-07 18:57       ` Linus Torvalds
2005-07-07 19:09         ` Christoph Lameter
2005-07-07 21:15           ` Andi Kleen
2005-07-07 21:19             ` Bartlomiej Zolnierkiewicz
2005-07-07 21:25               ` Andi Kleen
2005-07-08  4:44                 ` Christoph Lameter

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).