]> git.hungrycats.org Git - linux/commitdiff
[PATCH] sn: Fixed an oom in pci_bus_cvlink.c
authorAndrew Morton <akpm@osdl.org>
Mon, 19 Jan 2004 02:51:24 +0000 (18:51 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Mon, 19 Jan 2004 02:51:24 +0000 (18:51 -0800)
From: Pat Gefre <pfg@sgi.com>

Fixed an oom in pci_bus_cvlink.c
Also added slot to flush code

arch/ia64/sn/io/machvec/pci_bus_cvlink.c
include/asm-ia64/sn/pci/pcibr_private.h

index 4e16ea113087b6db43f4909cba93368dcf2b314e..2e99647c960b305b916e58f2e92fec493fa6007f 100644 (file)
@@ -213,6 +213,10 @@ sn_dma_flush_init(unsigned long start, unsigned long end, int idx, int pin, int
        if (flush_nasid_list[nasid].widget_p == NULL) {
                flush_nasid_list[nasid].widget_p = (struct sn_flush_device_list **)kmalloc((HUB_WIDGET_ID_MAX+1) *
                        sizeof(struct sn_flush_device_list *), GFP_KERNEL);
+               if (flush_nasid_list[nasid].widget_p <= 0) {
+                       printk("sn_dma_flush_init: Cannot allocate memory for nasid list\n");
+                       return;
+               }
                memset(flush_nasid_list[nasid].widget_p, 0, (HUB_WIDGET_ID_MAX+1) * sizeof(struct sn_flush_device_list *));
        }
        if (bwin > 0) {
@@ -240,22 +244,28 @@ sn_dma_flush_init(unsigned long start, unsigned long end, int idx, int pin, int
        if (flush_nasid_list[nasid].widget_p[wid_num] == NULL) {
                flush_nasid_list[nasid].widget_p[wid_num] = (struct sn_flush_device_list *)kmalloc(
                        DEV_PER_WIDGET * sizeof (struct sn_flush_device_list), GFP_KERNEL);
+               if (flush_nasid_list[nasid].widget_p[wid_num] <= 0) {
+                       printk("sn_dma_flush_init: Cannot allocate memory for nasid sub-list\n");
+                       return;
+               }
                memset(flush_nasid_list[nasid].widget_p[wid_num], 0, 
                        DEV_PER_WIDGET * sizeof (struct sn_flush_device_list));
                p = &flush_nasid_list[nasid].widget_p[wid_num][0];
                for (i=0; i<DEV_PER_WIDGET;i++) {
                        p->bus = -1;
                        p->pin = -1;
+                       p->slot = -1;
                        p++;
                }
        }
 
        p = &flush_nasid_list[nasid].widget_p[wid_num][0];
        for (i=0;i<DEV_PER_WIDGET; i++) {
-               if (p->pin == pin && p->bus == bus) break;
+               if (p->pin == pin && p->bus == bus && p->slot == slot) break;
                if (p->pin < 0) {
                        p->pin = pin;
                        p->bus = bus;
+                       p->slot = slot;
                        break;
                }
                p++;
index 4722c69e2220cd400c92acf735d6a2bf5395eee3..efc9fc59c7fc808e8cfd696078cd57a68f18d53b 100644 (file)
@@ -702,6 +702,7 @@ struct pcibr_list_s {
 
 struct sn_flush_device_list {
        int bus;
+       int slot;
        int pin;
        struct bar_list {
                unsigned long start;