lkml.org 
[lkml]   [2005]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Fix crash on boot in kmalloc_node IDE changes
On 7/6/05, Andi Kleen <ak@suse.de> wrote:
>
> 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;

drive->hwif check is redundant, please remove it

> @@ -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);
> + }

ditto, moreover hwif->drives[0].hwif == hwif

> + hwgroup = kmalloc_node(sizeof(ide_hwgroup_t), GFP_KERNEL,node);
> if (!hwgroup)
> goto out_up;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-07-06 21:25    [from the cache]
©2003-2011 Jasper Spaans