[SCSI] qla2xxx: fix panic caused by previous patch
authorSeokmann Ju <seokmann.ju@qlogic.com>
Mon, 30 Jul 2007 18:01:07 +0000 (11:01 -0700)
committerJames Bottomley <jejb@mulgrave.localdomain>
Tue, 31 Jul 2007 15:45:07 +0000 (10:45 -0500)
- this patch will fix a panic caused by omitted memory allocation for the nvram.

Signed-off-by: Seokmann Ju <seokmann.ju@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/qla2xxx/qla_os.c

index c488996cb95873503ef544ba9b4328ee7ae60a17..93c0c7e4f08f0c2a98e20e5121b5b2eb422d722f 100644 (file)
@@ -2154,6 +2154,19 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
                        }
                }
 
+               /* Get memory for cached NVRAM */
+               ha->nvram = kzalloc(MAX_NVRAM_SIZE, GFP_KERNEL);
+               if (ha->nvram == NULL) {
+                       /* error */
+                       qla_printk(KERN_WARNING, ha,
+                           "Memory Allocation failed - nvram cache\n");
+
+                       qla2x00_mem_free(ha);
+                       msleep(100);
+
+                       continue;
+               }
+
                /* Done all allocations without any error. */
                status = 0;
 
@@ -2266,6 +2279,7 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
        ha->fw_dump_reading = 0;
 
        vfree(ha->optrom_buffer);
+       kfree(ha->nvram);
 }
 
 /*