aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_attr.c
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2008-01-31 15:33:48 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-02-07 19:02:39 -0500
commite87110852d0bd331d50c3de686a7fc9626579d60 (patch)
tree9501f4a06588c14029c6e2487cfdfa0fb710f82e /drivers/scsi/qla2xxx/qla_attr.c
parent0afb467b4757adb9c6e3817f2e752d658a494352 (diff)
[SCSI] qla2xxx: Cleanse memory allocation logic during probe.
- Drop loop-till-allocated structure of code within qla2x00_mem_alloc(). - Properly unwind deallcations of memory during failures. - Drop qla2x00_allocate_sp_pool() and qla2x00_free_sp_pool() functions as their implementations can easily be collapsed into the callers. - Defer DMA pool allocation of SFP data until requested. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_attr.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index adf97320574..1dd8591bd5c 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -428,6 +428,19 @@ qla2x00_sysfs_read_sfp(struct kobject *kobj,
428 if (!capable(CAP_SYS_ADMIN) || off != 0 || count != SFP_DEV_SIZE * 2) 428 if (!capable(CAP_SYS_ADMIN) || off != 0 || count != SFP_DEV_SIZE * 2)
429 return 0; 429 return 0;
430 430
431 if (ha->sfp_data)
432 goto do_read;
433
434 ha->sfp_data = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL,
435 &ha->sfp_data_dma);
436 if (!ha->sfp_data) {
437 qla_printk(KERN_WARNING, ha,
438 "Unable to allocate memory for SFP read-data.\n");
439 return 0;
440 }
441
442do_read:
443 memset(ha->sfp_data, 0, SFP_BLOCK_SIZE);
431 addr = 0xa0; 444 addr = 0xa0;
432 for (iter = 0, offset = 0; iter < (SFP_DEV_SIZE * 2) / SFP_BLOCK_SIZE; 445 for (iter = 0, offset = 0; iter < (SFP_DEV_SIZE * 2) / SFP_BLOCK_SIZE;
433 iter++, offset += SFP_BLOCK_SIZE) { 446 iter++, offset += SFP_BLOCK_SIZE) {