aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-11-09 01:07:12 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-11-09 01:07:12 -0500
commita892acacd3a8546ac161526522f13b5174f2c471 (patch)
treeee6d36f27f1388989ebfcabf90253fb7194112ac /drivers/scsi
parent193515d51ccb363165d6b09e9ba5c21089e34bad (diff)
parent330d57fb98a916fa8e1363846540dd420e99499a (diff)
Merge branch 'master'
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/3w-9xxx.c3
-rw-r--r--drivers/scsi/NCR5380.c5
-rw-r--r--drivers/scsi/aacraid/commsup.c14
-rw-r--r--drivers/scsi/aacraid/rkt.c6
-rw-r--r--drivers/scsi/aacraid/rx.c6
-rw-r--r--drivers/scsi/aacraid/sa.c6
-rw-r--r--drivers/scsi/advansys.c12
-rw-r--r--drivers/scsi/aha1542.c36
-rw-r--r--drivers/scsi/aic7xxx_old.c3
-rw-r--r--drivers/scsi/arm/queue.c3
-rw-r--r--drivers/scsi/atari_dma_emul.c2
-rw-r--r--drivers/scsi/dc395x.c3
-rw-r--r--drivers/scsi/dpt_i2o.c61
-rw-r--r--drivers/scsi/eata.c3
-rw-r--r--drivers/scsi/ide-scsi.c10
-rw-r--r--drivers/scsi/ips.c18
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c9
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c6
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c7
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c12
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c7
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c5
-rw-r--r--drivers/scsi/megaraid/megaraid_mm.c11
-rw-r--r--drivers/scsi/osst.c9
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c16
-rw-r--r--drivers/scsi/raid_class.c2
-rw-r--r--drivers/scsi/scsi_transport_sas.c2
-rw-r--r--drivers/scsi/sg.c9
-rw-r--r--drivers/scsi/st.c3
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c1
-rw-r--r--drivers/scsi/u14-34f.c9
31 files changed, 105 insertions, 194 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index d06ee65d668d..3ff74f472249 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -1017,8 +1017,7 @@ static void twa_free_device_extension(TW_Device_Extension *tw_dev)
1017 tw_dev->generic_buffer_virt[0], 1017 tw_dev->generic_buffer_virt[0],
1018 tw_dev->generic_buffer_phys[0]); 1018 tw_dev->generic_buffer_phys[0]);
1019 1019
1020 if (tw_dev->event_queue[0]) 1020 kfree(tw_dev->event_queue[0]);
1021 kfree(tw_dev->event_queue[0]);
1022} /* End twa_free_device_extension() */ 1021} /* End twa_free_device_extension() */
1023 1022
1024/* This function will free a request id */ 1023/* This function will free a request id */
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index cc9ecb35b412..cba9655d0f14 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -606,10 +606,7 @@ static int __init NCR5380_probe_irq(struct Scsi_Host *instance, int possible)
606 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_SEL); 606 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_SEL);
607 607
608 while (probe_irq == SCSI_IRQ_NONE && time_before(jiffies, timeout)) 608 while (probe_irq == SCSI_IRQ_NONE && time_before(jiffies, timeout))
609 { 609 schedule_timeout_uninterruptible(1);
610 set_current_state(TASK_UNINTERRUPTIBLE);
611 schedule_timeout(1);
612 }
613 610
614 NCR5380_write(SELECT_ENABLE_REG, 0); 611 NCR5380_write(SELECT_ENABLE_REG, 0);
615 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 612 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index ee9067255930..723c0cea7c04 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1164,7 +1164,7 @@ int aac_command_thread(struct aac_dev * dev)
1164 kfree(hw_fib_pool); 1164 kfree(hw_fib_pool);
1165 hw_fib_pool = NULL; 1165 hw_fib_pool = NULL;
1166 } 1166 }
1167 } else if (hw_fib_pool) { 1167 } else {
1168 kfree(hw_fib_pool); 1168 kfree(hw_fib_pool);
1169 hw_fib_pool = NULL; 1169 hw_fib_pool = NULL;
1170 } 1170 }
@@ -1247,17 +1247,13 @@ int aac_command_thread(struct aac_dev * dev)
1247 hw_fib_p = hw_fib_pool; 1247 hw_fib_p = hw_fib_pool;
1248 fib_p = fib_pool; 1248 fib_p = fib_pool;
1249 while (hw_fib_p < &hw_fib_pool[num]) { 1249 while (hw_fib_p < &hw_fib_pool[num]) {
1250 if (*hw_fib_p) 1250 kfree(*hw_fib_p);
1251 kfree(*hw_fib_p); 1251 kfree(*fib_p);
1252 if (*fib_p)
1253 kfree(*fib_p);
1254 ++fib_p; 1252 ++fib_p;
1255 ++hw_fib_p; 1253 ++hw_fib_p;
1256 } 1254 }
1257 if (hw_fib_pool) 1255 kfree(hw_fib_pool);
1258 kfree(hw_fib_pool); 1256 kfree(fib_pool);
1259 if (fib_pool)
1260 kfree(fib_pool);
1261 } 1257 }
1262 kfree(fib); 1258 kfree(fib);
1263 spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags); 1259 spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags);
diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c
index fc4c73c2a6a9..e9b775d6bec9 100644
--- a/drivers/scsi/aacraid/rkt.c
+++ b/drivers/scsi/aacraid/rkt.c
@@ -183,8 +183,7 @@ static int rkt_sync_cmd(struct aac_dev *dev, u32 command,
183 /* 183 /*
184 * Yield the processor in case we are slow 184 * Yield the processor in case we are slow
185 */ 185 */
186 set_current_state(TASK_UNINTERRUPTIBLE); 186 schedule_timeout_uninterruptible(1);
187 schedule_timeout(1);
188 } 187 }
189 if (ok != 1) { 188 if (ok != 1) {
190 /* 189 /*
@@ -452,8 +451,7 @@ int aac_rkt_init(struct aac_dev *dev)
452 dev->name, instance, status); 451 dev->name, instance, status);
453 goto error_iounmap; 452 goto error_iounmap;
454 } 453 }
455 set_current_state(TASK_UNINTERRUPTIBLE); 454 schedule_timeout_uninterruptible(1);
456 schedule_timeout(1);
457 } 455 }
458 if (request_irq(dev->scsi_host_ptr->irq, aac_rkt_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0) 456 if (request_irq(dev->scsi_host_ptr->irq, aac_rkt_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0)
459 { 457 {
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index da99046e5393..6998bc877dd6 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -183,8 +183,7 @@ static int rx_sync_cmd(struct aac_dev *dev, u32 command,
183 /* 183 /*
184 * Yield the processor in case we are slow 184 * Yield the processor in case we are slow
185 */ 185 */
186 set_current_state(TASK_UNINTERRUPTIBLE); 186 schedule_timeout_uninterruptible(1);
187 schedule_timeout(1);
188 } 187 }
189 if (ok != 1) { 188 if (ok != 1) {
190 /* 189 /*
@@ -452,8 +451,7 @@ int aac_rx_init(struct aac_dev *dev)
452 dev->name, instance, status); 451 dev->name, instance, status);
453 goto error_iounmap; 452 goto error_iounmap;
454 } 453 }
455 set_current_state(TASK_UNINTERRUPTIBLE); 454 schedule_timeout_uninterruptible(1);
456 schedule_timeout(1);
457 } 455 }
458 if (request_irq(dev->scsi_host_ptr->irq, aac_rx_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0) 456 if (request_irq(dev->scsi_host_ptr->irq, aac_rx_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0)
459 { 457 {
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
index 8b9596209164..466f05cfbf0c 100644
--- a/drivers/scsi/aacraid/sa.c
+++ b/drivers/scsi/aacraid/sa.c
@@ -189,8 +189,7 @@ static int sa_sync_cmd(struct aac_dev *dev, u32 command,
189 ok = 1; 189 ok = 1;
190 break; 190 break;
191 } 191 }
192 set_current_state(TASK_UNINTERRUPTIBLE); 192 schedule_timeout_uninterruptible(1);
193 schedule_timeout(1);
194 } 193 }
195 194
196 if (ok != 1) 195 if (ok != 1)
@@ -325,8 +324,7 @@ int aac_sa_init(struct aac_dev *dev)
325 name, instance, status); 324 name, instance, status);
326 goto error_iounmap; 325 goto error_iounmap;
327 } 326 }
328 set_current_state(TASK_UNINTERRUPTIBLE); 327 schedule_timeout_uninterruptible(1);
329 schedule_timeout(1);
330 } 328 }
331 329
332 if (request_irq(dev->scsi_host_ptr->irq, aac_sa_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev ) < 0) { 330 if (request_irq(dev->scsi_host_ptr->irq, aac_sa_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev ) < 0) {
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 37ec5411e325..f4cfb8f29620 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -5402,10 +5402,8 @@ advansys_detect(struct scsi_host_template *tpnt)
5402 release_region(shp->io_port, boardp->asc_n_io_port); 5402 release_region(shp->io_port, boardp->asc_n_io_port);
5403 if (ASC_WIDE_BOARD(boardp)) { 5403 if (ASC_WIDE_BOARD(boardp)) {
5404 iounmap(boardp->ioremap_addr); 5404 iounmap(boardp->ioremap_addr);
5405 if (boardp->orig_carrp) { 5405 kfree(boardp->orig_carrp);
5406 kfree(boardp->orig_carrp); 5406 boardp->orig_carrp = NULL;
5407 boardp->orig_carrp = NULL;
5408 }
5409 if (boardp->orig_reqp) { 5407 if (boardp->orig_reqp) {
5410 kfree(boardp->orig_reqp); 5408 kfree(boardp->orig_reqp);
5411 boardp->orig_reqp = boardp->adv_reqp = NULL; 5409 boardp->orig_reqp = boardp->adv_reqp = NULL;
@@ -5457,10 +5455,8 @@ advansys_release(struct Scsi_Host *shp)
5457 adv_sgblk_t *sgp = NULL; 5455 adv_sgblk_t *sgp = NULL;
5458 5456
5459 iounmap(boardp->ioremap_addr); 5457 iounmap(boardp->ioremap_addr);
5460 if (boardp->orig_carrp) { 5458 kfree(boardp->orig_carrp);
5461 kfree(boardp->orig_carrp); 5459 boardp->orig_carrp = NULL;
5462 boardp->orig_carrp = NULL;
5463 }
5464 if (boardp->orig_reqp) { 5460 if (boardp->orig_reqp) {
5465 kfree(boardp->orig_reqp); 5461 kfree(boardp->orig_reqp);
5466 boardp->orig_reqp = boardp->adv_reqp = NULL; 5462 boardp->orig_reqp = boardp->adv_reqp = NULL;
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index adda750412f2..1b1adfb384cb 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -543,10 +543,8 @@ static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id, struct pt
543 return; 543 return;
544 } 544 }
545 my_done = SCtmp->scsi_done; 545 my_done = SCtmp->scsi_done;
546 if (SCtmp->host_scribble) { 546 kfree(SCtmp->host_scribble);
547 kfree(SCtmp->host_scribble); 547 SCtmp->host_scribble = NULL;
548 SCtmp->host_scribble = NULL;
549 }
550 /* Fetch the sense data, and tuck it away, in the required slot. The 548 /* Fetch the sense data, and tuck it away, in the required slot. The
551 Adaptec automatically fetches it, and there is no guarantee that 549 Adaptec automatically fetches it, and there is no guarantee that
552 we will still have it in the cdb when we come back */ 550 we will still have it in the cdb when we come back */
@@ -1432,10 +1430,8 @@ static int aha1542_dev_reset(Scsi_Cmnd * SCpnt)
1432 HOSTDATA(SCpnt->host)->SCint[i]->target == SCpnt->target) { 1430 HOSTDATA(SCpnt->host)->SCint[i]->target == SCpnt->target) {
1433 Scsi_Cmnd *SCtmp; 1431 Scsi_Cmnd *SCtmp;
1434 SCtmp = HOSTDATA(SCpnt->host)->SCint[i]; 1432 SCtmp = HOSTDATA(SCpnt->host)->SCint[i];
1435 if (SCtmp->host_scribble) { 1433 kfree(SCtmp->host_scribble);
1436 kfree(SCtmp->host_scribble); 1434 SCtmp->host_scribble = NULL;
1437 SCtmp->host_scribble = NULL;
1438 }
1439 HOSTDATA(SCpnt->host)->SCint[i] = NULL; 1435 HOSTDATA(SCpnt->host)->SCint[i] = NULL;
1440 HOSTDATA(SCpnt->host)->mb[i].status = 0; 1436 HOSTDATA(SCpnt->host)->mb[i].status = 0;
1441 } 1437 }
@@ -1495,10 +1491,8 @@ static int aha1542_bus_reset(Scsi_Cmnd * SCpnt)
1495 */ 1491 */
1496 continue; 1492 continue;
1497 } 1493 }
1498 if (SCtmp->host_scribble) { 1494 kfree(SCtmp->host_scribble);
1499 kfree(SCtmp->host_scribble); 1495 SCtmp->host_scribble = NULL;
1500 SCtmp->host_scribble = NULL;
1501 }
1502 HOSTDATA(SCpnt->device->host)->SCint[i] = NULL; 1496 HOSTDATA(SCpnt->device->host)->SCint[i] = NULL;
1503 HOSTDATA(SCpnt->device->host)->mb[i].status = 0; 1497 HOSTDATA(SCpnt->device->host)->mb[i].status = 0;
1504 } 1498 }
@@ -1565,10 +1559,8 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt)
1565 */ 1559 */
1566 continue; 1560 continue;
1567 } 1561 }
1568 if (SCtmp->host_scribble) { 1562 kfree(SCtmp->host_scribble);
1569 kfree(SCtmp->host_scribble); 1563 SCtmp->host_scribble = NULL;
1570 SCtmp->host_scribble = NULL;
1571 }
1572 HOSTDATA(SCpnt->device->host)->SCint[i] = NULL; 1564 HOSTDATA(SCpnt->device->host)->SCint[i] = NULL;
1573 HOSTDATA(SCpnt->device->host)->mb[i].status = 0; 1565 HOSTDATA(SCpnt->device->host)->mb[i].status = 0;
1574 } 1566 }
@@ -1711,10 +1703,8 @@ static int aha1542_old_reset(Scsi_Cmnd * SCpnt, unsigned int reset_flags)
1711 Scsi_Cmnd *SCtmp; 1703 Scsi_Cmnd *SCtmp;
1712 SCtmp = HOSTDATA(SCpnt->host)->SCint[i]; 1704 SCtmp = HOSTDATA(SCpnt->host)->SCint[i];
1713 SCtmp->result = DID_RESET << 16; 1705 SCtmp->result = DID_RESET << 16;
1714 if (SCtmp->host_scribble) { 1706 kfree(SCtmp->host_scribble);
1715 kfree(SCtmp->host_scribble); 1707 SCtmp->host_scribble = NULL;
1716 SCtmp->host_scribble = NULL;
1717 }
1718 printk(KERN_WARNING "Sending DID_RESET for target %d\n", SCpnt->target); 1708 printk(KERN_WARNING "Sending DID_RESET for target %d\n", SCpnt->target);
1719 SCtmp->scsi_done(SCpnt); 1709 SCtmp->scsi_done(SCpnt);
1720 1710
@@ -1757,10 +1747,8 @@ fail:
1757 Scsi_Cmnd *SCtmp; 1747 Scsi_Cmnd *SCtmp;
1758 SCtmp = HOSTDATA(SCpnt->host)->SCint[i]; 1748 SCtmp = HOSTDATA(SCpnt->host)->SCint[i];
1759 SCtmp->result = DID_RESET << 16; 1749 SCtmp->result = DID_RESET << 16;
1760 if (SCtmp->host_scribble) { 1750 kfree(SCtmp->host_scribble);
1761 kfree(SCtmp->host_scribble); 1751 SCtmp->host_scribble = NULL;
1762 SCtmp->host_scribble = NULL;
1763 }
1764 printk(KERN_WARNING "Sending DID_RESET for target %d\n", SCpnt->target); 1752 printk(KERN_WARNING "Sending DID_RESET for target %d\n", SCpnt->target);
1765 SCtmp->scsi_done(SCpnt); 1753 SCtmp->scsi_done(SCpnt);
1766 1754
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index 52b72d7794f5..880e2d9ffe9b 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -8492,8 +8492,7 @@ aic7xxx_free(struct aic7xxx_host *p)
8492 - scb_dma->dma_offset), 8492 - scb_dma->dma_offset),
8493 scb_dma->dma_address); 8493 scb_dma->dma_address);
8494 } 8494 }
8495 if (p->scb_data->scb_array[i]->kmalloc_ptr != NULL) 8495 kfree(p->scb_data->scb_array[i]->kmalloc_ptr);
8496 kfree(p->scb_data->scb_array[i]->kmalloc_ptr);
8497 p->scb_data->scb_array[i] = NULL; 8496 p->scb_data->scb_array[i] = NULL;
8498 } 8497 }
8499 8498
diff --git a/drivers/scsi/arm/queue.c b/drivers/scsi/arm/queue.c
index e6d159270d29..b10750bb5c09 100644
--- a/drivers/scsi/arm/queue.c
+++ b/drivers/scsi/arm/queue.c
@@ -91,8 +91,7 @@ void queue_free (Queue_t *queue)
91{ 91{
92 if (!list_empty(&queue->head)) 92 if (!list_empty(&queue->head))
93 printk(KERN_WARNING "freeing non-empty queue %p\n", queue); 93 printk(KERN_WARNING "freeing non-empty queue %p\n", queue);
94 if (queue->alloc) 94 kfree(queue->alloc);
95 kfree(queue->alloc);
96} 95}
97 96
98 97
diff --git a/drivers/scsi/atari_dma_emul.c b/drivers/scsi/atari_dma_emul.c
index 7026045527fd..8d5d2a5da961 100644
--- a/drivers/scsi/atari_dma_emul.c
+++ b/drivers/scsi/atari_dma_emul.c
@@ -19,6 +19,8 @@
19 * this code. 19 * this code.
20 */ 20 */
21 21
22#include <linux/compiler.h>
23#include <asm/thread_info.h>
22#include <asm/uaccess.h> 24#include <asm/uaccess.h>
23 25
24#define hades_dma_ctrl (*(unsigned char *) 0xffff8717) 26#define hades_dma_ctrl (*(unsigned char *) 0xffff8717)
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index c44af5795b10..c8a32cf47d73 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -4270,8 +4270,7 @@ static void adapter_sg_tables_free(struct AdapterCtlBlk *acb)
4270 const unsigned srbs_per_page = PAGE_SIZE/SEGMENTX_LEN; 4270 const unsigned srbs_per_page = PAGE_SIZE/SEGMENTX_LEN;
4271 4271
4272 for (i = 0; i < DC395x_MAX_SRB_CNT; i += srbs_per_page) 4272 for (i = 0; i < DC395x_MAX_SRB_CNT; i += srbs_per_page)
4273 if (acb->srb_array[i].segment_x) 4273 kfree(acb->srb_array[i].segment_x);
4274 kfree(acb->srb_array[i].segment_x);
4275} 4274}
4276 4275
4277 4276
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 7235f94f1191..c28e3aea1c3c 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -1037,18 +1037,10 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
1037 if(pHba->msg_addr_virt != pHba->base_addr_virt){ 1037 if(pHba->msg_addr_virt != pHba->base_addr_virt){
1038 iounmap(pHba->msg_addr_virt); 1038 iounmap(pHba->msg_addr_virt);
1039 } 1039 }
1040 if(pHba->hrt) { 1040 kfree(pHba->hrt);
1041 kfree(pHba->hrt); 1041 kfree(pHba->lct);
1042 } 1042 kfree(pHba->status_block);
1043 if(pHba->lct){ 1043 kfree(pHba->reply_pool);
1044 kfree(pHba->lct);
1045 }
1046 if(pHba->status_block) {
1047 kfree(pHba->status_block);
1048 }
1049 if(pHba->reply_pool){
1050 kfree(pHba->reply_pool);
1051 }
1052 1044
1053 for(d = pHba->devices; d ; d = next){ 1045 for(d = pHba->devices; d ; d = next){
1054 next = d->next; 1046 next = d->next;
@@ -1218,8 +1210,7 @@ static s32 adpt_i2o_post_this(adpt_hba* pHba, u32* data, int len)
1218 printk(KERN_WARNING"dpti%d: Timeout waiting for message frame!\n", pHba->unit); 1210 printk(KERN_WARNING"dpti%d: Timeout waiting for message frame!\n", pHba->unit);
1219 return -ETIMEDOUT; 1211 return -ETIMEDOUT;
1220 } 1212 }
1221 set_current_state(TASK_UNINTERRUPTIBLE); 1213 schedule_timeout_uninterruptible(1);
1222 schedule_timeout(1);
1223 } while(m == EMPTY_QUEUE); 1214 } while(m == EMPTY_QUEUE);
1224 1215
1225 msg = pHba->msg_addr_virt + m; 1216 msg = pHba->msg_addr_virt + m;
@@ -1294,8 +1285,7 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba)
1294 printk(KERN_WARNING"Timeout waiting for message!\n"); 1285 printk(KERN_WARNING"Timeout waiting for message!\n");
1295 return -ETIMEDOUT; 1286 return -ETIMEDOUT;
1296 } 1287 }
1297 set_current_state(TASK_UNINTERRUPTIBLE); 1288 schedule_timeout_uninterruptible(1);
1298 schedule_timeout(1);
1299 } while (m == EMPTY_QUEUE); 1289 } while (m == EMPTY_QUEUE);
1300 1290
1301 status = (u8*)kmalloc(4, GFP_KERNEL|ADDR32); 1291 status = (u8*)kmalloc(4, GFP_KERNEL|ADDR32);
@@ -1327,8 +1317,7 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba)
1327 return -ETIMEDOUT; 1317 return -ETIMEDOUT;
1328 } 1318 }
1329 rmb(); 1319 rmb();
1330 set_current_state(TASK_UNINTERRUPTIBLE); 1320 schedule_timeout_uninterruptible(1);
1331 schedule_timeout(1);
1332 } 1321 }
1333 1322
1334 if(*status == 0x01 /*I2O_EXEC_IOP_RESET_IN_PROGRESS*/) { 1323 if(*status == 0x01 /*I2O_EXEC_IOP_RESET_IN_PROGRESS*/) {
@@ -1345,8 +1334,7 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba)
1345 printk(KERN_ERR "%s:Timeout waiting for IOP Reset.\n",pHba->name); 1334 printk(KERN_ERR "%s:Timeout waiting for IOP Reset.\n",pHba->name);
1346 return -ETIMEDOUT; 1335 return -ETIMEDOUT;
1347 } 1336 }
1348 set_current_state(TASK_UNINTERRUPTIBLE); 1337 schedule_timeout_uninterruptible(1);
1349 schedule_timeout(1);
1350 } while (m == EMPTY_QUEUE); 1338 } while (m == EMPTY_QUEUE);
1351 // Flush the offset 1339 // Flush the offset
1352 adpt_send_nop(pHba, m); 1340 adpt_send_nop(pHba, m);
@@ -1917,11 +1905,8 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
1917 return -ENXIO; 1905 return -ENXIO;
1918 } 1906 }
1919 1907
1920 while((volatile u32) pHba->state & DPTI_STATE_RESET ) { 1908 while((volatile u32) pHba->state & DPTI_STATE_RESET )
1921 set_task_state(current,TASK_UNINTERRUPTIBLE); 1909 schedule_timeout_uninterruptible(2);
1922 schedule_timeout(2);
1923
1924 }
1925 1910
1926 switch (cmd) { 1911 switch (cmd) {
1927 // TODO: handle 3 cases 1912 // TODO: handle 3 cases
@@ -2635,8 +2620,7 @@ static s32 adpt_send_nop(adpt_hba*pHba,u32 m)
2635 printk(KERN_ERR "%s: Timeout waiting for message frame!\n",pHba->name); 2620 printk(KERN_ERR "%s: Timeout waiting for message frame!\n",pHba->name);
2636 return 2; 2621 return 2;
2637 } 2622 }
2638 set_current_state(TASK_UNINTERRUPTIBLE); 2623 schedule_timeout_uninterruptible(1);
2639 schedule_timeout(1);
2640 } 2624 }
2641 msg = (u32 __iomem *)(pHba->msg_addr_virt + m); 2625 msg = (u32 __iomem *)(pHba->msg_addr_virt + m);
2642 writel( THREE_WORD_MSG_SIZE | SGL_OFFSET_0,&msg[0]); 2626 writel( THREE_WORD_MSG_SIZE | SGL_OFFSET_0,&msg[0]);
@@ -2670,8 +2654,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba)
2670 printk(KERN_WARNING"%s: Timeout waiting for message frame\n",pHba->name); 2654 printk(KERN_WARNING"%s: Timeout waiting for message frame\n",pHba->name);
2671 return -ETIMEDOUT; 2655 return -ETIMEDOUT;
2672 } 2656 }
2673 set_current_state(TASK_UNINTERRUPTIBLE); 2657 schedule_timeout_uninterruptible(1);
2674 schedule_timeout(1);
2675 } while(m == EMPTY_QUEUE); 2658 } while(m == EMPTY_QUEUE);
2676 2659
2677 msg=(u32 __iomem *)(pHba->msg_addr_virt+m); 2660 msg=(u32 __iomem *)(pHba->msg_addr_virt+m);
@@ -2709,21 +2692,18 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba)
2709 printk(KERN_WARNING"%s: Timeout Initializing\n",pHba->name); 2692 printk(KERN_WARNING"%s: Timeout Initializing\n",pHba->name);
2710 return -ETIMEDOUT; 2693 return -ETIMEDOUT;
2711 } 2694 }
2712 set_current_state(TASK_UNINTERRUPTIBLE); 2695 schedule_timeout_uninterruptible(1);
2713 schedule_timeout(1);
2714 } while (1); 2696 } while (1);
2715 2697
2716 // If the command was successful, fill the fifo with our reply 2698 // If the command was successful, fill the fifo with our reply
2717 // message packets 2699 // message packets
2718 if(*status != 0x04 /*I2O_EXEC_OUTBOUND_INIT_COMPLETE*/) { 2700 if(*status != 0x04 /*I2O_EXEC_OUTBOUND_INIT_COMPLETE*/) {
2719 kfree((void*)status); 2701 kfree(status);
2720 return -2; 2702 return -2;
2721 } 2703 }
2722 kfree((void*)status); 2704 kfree(status);
2723 2705
2724 if(pHba->reply_pool != NULL){ 2706 kfree(pHba->reply_pool);
2725 kfree(pHba->reply_pool);
2726 }
2727 2707
2728 pHba->reply_pool = (u32*)kmalloc(pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, GFP_KERNEL|ADDR32); 2708 pHba->reply_pool = (u32*)kmalloc(pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, GFP_KERNEL|ADDR32);
2729 if(!pHba->reply_pool){ 2709 if(!pHba->reply_pool){
@@ -2788,8 +2768,7 @@ static s32 adpt_i2o_status_get(adpt_hba* pHba)
2788 pHba->name); 2768 pHba->name);
2789 return -ETIMEDOUT; 2769 return -ETIMEDOUT;
2790 } 2770 }
2791 set_current_state(TASK_UNINTERRUPTIBLE); 2771 schedule_timeout_uninterruptible(1);
2792 schedule_timeout(1);
2793 } while(m==EMPTY_QUEUE); 2772 } while(m==EMPTY_QUEUE);
2794 2773
2795 2774
@@ -2816,8 +2795,7 @@ static s32 adpt_i2o_status_get(adpt_hba* pHba)
2816 return -ETIMEDOUT; 2795 return -ETIMEDOUT;
2817 } 2796 }
2818 rmb(); 2797 rmb();
2819 set_current_state(TASK_UNINTERRUPTIBLE); 2798 schedule_timeout_uninterruptible(1);
2820 schedule_timeout(1);
2821 } 2799 }
2822 2800
2823 // Set up our number of outbound and inbound messages 2801 // Set up our number of outbound and inbound messages
@@ -2941,8 +2919,7 @@ static int adpt_i2o_build_sys_table(void)
2941 sys_tbl_len = sizeof(struct i2o_sys_tbl) + // Header + IOPs 2919 sys_tbl_len = sizeof(struct i2o_sys_tbl) + // Header + IOPs
2942 (hba_count) * sizeof(struct i2o_sys_tbl_entry); 2920 (hba_count) * sizeof(struct i2o_sys_tbl_entry);
2943 2921
2944 if(sys_tbl) 2922 kfree(sys_tbl);
2945 kfree(sys_tbl);
2946 2923
2947 sys_tbl = kmalloc(sys_tbl_len, GFP_KERNEL|ADDR32); 2924 sys_tbl = kmalloc(sys_tbl_len, GFP_KERNEL|ADDR32);
2948 if(!sys_tbl) { 2925 if(!sys_tbl) {
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index b45a4c730230..b3f9de8f7595 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -2580,8 +2580,7 @@ static int eata2x_release(struct Scsi_Host *shost)
2580 unsigned int i; 2580 unsigned int i;
2581 2581
2582 for (i = 0; i < shost->can_queue; i++) 2582 for (i = 0; i < shost->can_queue; i++)
2583 if ((&ha->cp[i])->sglist) 2583 kfree((&ha->cp[i])->sglist);
2584 kfree((&ha->cp[i])->sglist);
2585 2584
2586 for (i = 0; i < shost->can_queue; i++) 2585 for (i = 0; i < shost->can_queue; i++)
2587 pci_unmap_single(ha->pdev, ha->cp[i].cp_dma_addr, 2586 pci_unmap_single(ha->pdev, ha->cp[i].cp_dma_addr,
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index f04f3289938d..c888af4a4562 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -331,9 +331,9 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co
331 rq = kmalloc (sizeof (struct request), GFP_ATOMIC); 331 rq = kmalloc (sizeof (struct request), GFP_ATOMIC);
332 buf = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC); 332 buf = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC);
333 if (pc == NULL || rq == NULL || buf == NULL) { 333 if (pc == NULL || rq == NULL || buf == NULL) {
334 if (pc) kfree(pc); 334 kfree(buf);
335 if (rq) kfree(rq); 335 kfree(rq);
336 if (buf) kfree(buf); 336 kfree(pc);
337 return -ENOMEM; 337 return -ENOMEM;
338 } 338 }
339 memset (pc, 0, sizeof (idescsi_pc_t)); 339 memset (pc, 0, sizeof (idescsi_pc_t));
@@ -949,8 +949,8 @@ static int idescsi_queue (struct scsi_cmnd *cmd,
949 spin_lock_irq(host->host_lock); 949 spin_lock_irq(host->host_lock);
950 return 0; 950 return 0;
951abort: 951abort:
952 if (pc) kfree (pc); 952 kfree (pc);
953 if (rq) kfree (rq); 953 kfree (rq);
954 cmd->result = DID_ERROR << 16; 954 cmd->result = DID_ERROR << 16;
955 done(cmd); 955 done(cmd);
956 return 0; 956 return 0;
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 68e5b2ab27c4..cd9b95db5a7d 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -4517,10 +4517,8 @@ ips_free(ips_ha_t * ha)
4517 ha->enq = NULL; 4517 ha->enq = NULL;
4518 } 4518 }
4519 4519
4520 if (ha->conf) { 4520 kfree(ha->conf);
4521 kfree(ha->conf); 4521 ha->conf = NULL;
4522 ha->conf = NULL;
4523 }
4524 4522
4525 if (ha->adapt) { 4523 if (ha->adapt) {
4526 pci_free_consistent(ha->pcidev, 4524 pci_free_consistent(ha->pcidev,
@@ -4538,15 +4536,11 @@ ips_free(ips_ha_t * ha)
4538 ha->logical_drive_info = NULL; 4536 ha->logical_drive_info = NULL;
4539 } 4537 }
4540 4538
4541 if (ha->nvram) { 4539 kfree(ha->nvram);
4542 kfree(ha->nvram); 4540 ha->nvram = NULL;
4543 ha->nvram = NULL;
4544 }
4545 4541
4546 if (ha->subsys) { 4542 kfree(ha->subsys);
4547 kfree(ha->subsys); 4543 ha->subsys = NULL;
4548 ha->subsys = NULL;
4549 }
4550 4544
4551 if (ha->ioctl_data) { 4545 if (ha->ioctl_data) {
4552 pci_free_consistent(ha->pcidev, ha->ioctl_len, 4546 pci_free_consistent(ha->pcidev, ha->ioctl_len,
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 08a0c00cfc30..bcc29ec126dc 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -127,8 +127,7 @@ lpfc_prep_els_iocb(struct lpfc_hba * phba,
127 if (((pcmd = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL)) == 0) || 127 if (((pcmd = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL)) == 0) ||
128 ((pcmd->virt = lpfc_mbuf_alloc(phba, 128 ((pcmd->virt = lpfc_mbuf_alloc(phba,
129 MEM_PRI, &(pcmd->phys))) == 0)) { 129 MEM_PRI, &(pcmd->phys))) == 0)) {
130 if (pcmd) 130 kfree(pcmd);
131 kfree(pcmd);
132 131
133 spin_lock_irq(phba->host->host_lock); 132 spin_lock_irq(phba->host->host_lock);
134 lpfc_sli_release_iocbq(phba, elsiocb); 133 lpfc_sli_release_iocbq(phba, elsiocb);
@@ -145,8 +144,7 @@ lpfc_prep_els_iocb(struct lpfc_hba * phba,
145 prsp->virt = lpfc_mbuf_alloc(phba, MEM_PRI, 144 prsp->virt = lpfc_mbuf_alloc(phba, MEM_PRI,
146 &prsp->phys); 145 &prsp->phys);
147 if (prsp == 0 || prsp->virt == 0) { 146 if (prsp == 0 || prsp->virt == 0) {
148 if (prsp) 147 kfree(prsp);
149 kfree(prsp);
150 lpfc_mbuf_free(phba, pcmd->virt, pcmd->phys); 148 lpfc_mbuf_free(phba, pcmd->virt, pcmd->phys);
151 kfree(pcmd); 149 kfree(pcmd);
152 spin_lock_irq(phba->host->host_lock); 150 spin_lock_irq(phba->host->host_lock);
@@ -172,8 +170,7 @@ lpfc_prep_els_iocb(struct lpfc_hba * phba,
172 lpfc_mbuf_free(phba, prsp->virt, prsp->phys); 170 lpfc_mbuf_free(phba, prsp->virt, prsp->phys);
173 kfree(pcmd); 171 kfree(pcmd);
174 kfree(prsp); 172 kfree(prsp);
175 if (pbuflist) 173 kfree(pbuflist);
176 kfree(pbuflist);
177 return NULL; 174 return NULL;
178 } 175 }
179 176
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 4e04470321a2..c90723860a04 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -894,8 +894,7 @@ lpfc_post_buffer(struct lpfc_hba * phba, struct lpfc_sli_ring * pring, int cnt,
894 mp1->virt = lpfc_mbuf_alloc(phba, MEM_PRI, 894 mp1->virt = lpfc_mbuf_alloc(phba, MEM_PRI,
895 &mp1->phys); 895 &mp1->phys);
896 if (mp1 == 0 || mp1->virt == 0) { 896 if (mp1 == 0 || mp1->virt == 0) {
897 if (mp1) 897 kfree(mp1);
898 kfree(mp1);
899 spin_lock_irq(phba->host->host_lock); 898 spin_lock_irq(phba->host->host_lock);
900 lpfc_sli_release_iocbq(phba, iocb); 899 lpfc_sli_release_iocbq(phba, iocb);
901 spin_unlock_irq(phba->host->host_lock); 900 spin_unlock_irq(phba->host->host_lock);
@@ -911,8 +910,7 @@ lpfc_post_buffer(struct lpfc_hba * phba, struct lpfc_sli_ring * pring, int cnt,
911 mp2->virt = lpfc_mbuf_alloc(phba, MEM_PRI, 910 mp2->virt = lpfc_mbuf_alloc(phba, MEM_PRI,
912 &mp2->phys); 911 &mp2->phys);
913 if (mp2 == 0 || mp2->virt == 0) { 912 if (mp2 == 0 || mp2->virt == 0) {
914 if (mp2) 913 kfree(mp2);
915 kfree(mp2);
916 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); 914 lpfc_mbuf_free(phba, mp1->virt, mp1->phys);
917 kfree(mp1); 915 kfree(mp1);
918 spin_lock_irq(phba->host->host_lock); 916 spin_lock_irq(phba->host->host_lock);
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 31c20cc00609..e3bc8d3f7302 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -248,8 +248,7 @@ lpfc_read_sparam(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
248 248
249 if (((mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL)) == 0) || 249 if (((mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL)) == 0) ||
250 ((mp->virt = lpfc_mbuf_alloc(phba, 0, &(mp->phys))) == 0)) { 250 ((mp->virt = lpfc_mbuf_alloc(phba, 0, &(mp->phys))) == 0)) {
251 if (mp) 251 kfree(mp);
252 kfree(mp);
253 mb->mbxCommand = MBX_READ_SPARM64; 252 mb->mbxCommand = MBX_READ_SPARM64;
254 /* READ_SPARAM: no buffers */ 253 /* READ_SPARAM: no buffers */
255 lpfc_printf_log(phba, 254 lpfc_printf_log(phba,
@@ -363,9 +362,7 @@ lpfc_reg_login(struct lpfc_hba * phba,
363 /* Get a buffer to hold NPorts Service Parameters */ 362 /* Get a buffer to hold NPorts Service Parameters */
364 if (((mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL)) == NULL) || 363 if (((mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL)) == NULL) ||
365 ((mp->virt = lpfc_mbuf_alloc(phba, 0, &(mp->phys))) == 0)) { 364 ((mp->virt = lpfc_mbuf_alloc(phba, 0, &(mp->phys))) == 0)) {
366 if (mp) 365 kfree(mp);
367 kfree(mp);
368
369 mb->mbxCommand = MBX_REG_LOGIN64; 366 mb->mbxCommand = MBX_REG_LOGIN64;
370 /* REG_LOGIN: no buffers */ 367 /* REG_LOGIN: no buffers */
371 lpfc_printf_log(phba, 368 lpfc_printf_log(phba,
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index c34d3cf4f19c..c63275e66e2e 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -825,8 +825,7 @@ __lpfc_abort_handler(struct scsi_cmnd *cmnd)
825 while (lpfc_cmd->pCmd == cmnd) 825 while (lpfc_cmd->pCmd == cmnd)
826 { 826 {
827 spin_unlock_irq(phba->host->host_lock); 827 spin_unlock_irq(phba->host->host_lock);
828 set_current_state(TASK_UNINTERRUPTIBLE); 828 schedule_timeout_uninterruptible(LPFC_ABORT_WAIT*HZ);
829 schedule_timeout(LPFC_ABORT_WAIT*HZ);
830 spin_lock_irq(phba->host->host_lock); 829 spin_lock_irq(phba->host->host_lock);
831 if (++loop_count 830 if (++loop_count
832 > (2 * phba->cfg_nodev_tmo)/LPFC_ABORT_WAIT) 831 > (2 * phba->cfg_nodev_tmo)/LPFC_ABORT_WAIT)
@@ -885,8 +884,7 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
885 884
886 if (pnode->nlp_state != NLP_STE_MAPPED_NODE) { 885 if (pnode->nlp_state != NLP_STE_MAPPED_NODE) {
887 spin_unlock_irq(phba->host->host_lock); 886 spin_unlock_irq(phba->host->host_lock);
888 set_current_state(TASK_UNINTERRUPTIBLE); 887 schedule_timeout_uninterruptible(msecs_to_jiffies(500));
889 schedule_timeout( HZ/2);
890 spin_lock_irq(phba->host->host_lock); 888 spin_lock_irq(phba->host->host_lock);
891 } 889 }
892 if ((pnode) && (pnode->nlp_state == NLP_STE_MAPPED_NODE)) 890 if ((pnode) && (pnode->nlp_state == NLP_STE_MAPPED_NODE))
@@ -939,8 +937,7 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
939 cmnd->device->id, cmnd->device->lun, 937 cmnd->device->id, cmnd->device->lun,
940 LPFC_CTX_LUN))) { 938 LPFC_CTX_LUN))) {
941 spin_unlock_irq(phba->host->host_lock); 939 spin_unlock_irq(phba->host->host_lock);
942 set_current_state(TASK_UNINTERRUPTIBLE); 940 schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ);
943 schedule_timeout(LPFC_RESET_WAIT*HZ);
944 spin_lock_irq(phba->host->host_lock); 941 spin_lock_irq(phba->host->host_lock);
945 942
946 if (++loopcnt 943 if (++loopcnt
@@ -1038,8 +1035,7 @@ __lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
1038 &phba->sli.ring[phba->sli.fcp_ring], 1035 &phba->sli.ring[phba->sli.fcp_ring],
1039 0, 0, LPFC_CTX_HOST))) { 1036 0, 0, LPFC_CTX_HOST))) {
1040 spin_unlock_irq(phba->host->host_lock); 1037 spin_unlock_irq(phba->host->host_lock);
1041 set_current_state(TASK_UNINTERRUPTIBLE); 1038 schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ);
1042 schedule_timeout(LPFC_RESET_WAIT*HZ);
1043 spin_lock_irq(phba->host->host_lock); 1039 spin_lock_irq(phba->host->host_lock);
1044 1040
1045 if (++loopcnt 1041 if (++loopcnt
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 508710001ed6..e2c08c5d83fb 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -2269,11 +2269,8 @@ lpfc_sli_hba_down(struct lpfc_hba * phba)
2269 2269
2270 INIT_LIST_HEAD(&(pring->txq)); 2270 INIT_LIST_HEAD(&(pring->txq));
2271 2271
2272 if (pring->fast_lookup) { 2272 kfree(pring->fast_lookup);
2273 kfree(pring->fast_lookup); 2273 pring->fast_lookup = NULL;
2274 pring->fast_lookup = NULL;
2275 }
2276
2277 } 2274 }
2278 2275
2279 spin_unlock_irqrestore(phba->host->host_lock, flags); 2276 spin_unlock_irqrestore(phba->host->host_lock, flags);
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index c9e743ba09ec..1a3d195a2d36 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -3937,9 +3937,8 @@ megaraid_sysfs_free_resources(adapter_t *adapter)
3937{ 3937{
3938 mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter); 3938 mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter);
3939 3939
3940 if (raid_dev->sysfs_uioc) kfree(raid_dev->sysfs_uioc); 3940 kfree(raid_dev->sysfs_uioc);
3941 3941 kfree(raid_dev->sysfs_mbox64);
3942 if (raid_dev->sysfs_mbox64) kfree(raid_dev->sysfs_mbox64);
3943 3942
3944 if (raid_dev->sysfs_buffer) { 3943 if (raid_dev->sysfs_buffer) {
3945 pci_free_consistent(adapter->pdev, PAGE_SIZE, 3944 pci_free_consistent(adapter->pdev, PAGE_SIZE,
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
index 37d110e864c4..8f3ce0432295 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -995,17 +995,13 @@ pthru_dma_pool_error:
995 995
996memalloc_error: 996memalloc_error:
997 997
998 if (adapter->kioc_list) 998 kfree(adapter->kioc_list);
999 kfree(adapter->kioc_list); 999 kfree(adapter->mbox_list);
1000
1001 if (adapter->mbox_list)
1002 kfree(adapter->mbox_list);
1003 1000
1004 if (adapter->pthru_dma_pool) 1001 if (adapter->pthru_dma_pool)
1005 pci_pool_destroy(adapter->pthru_dma_pool); 1002 pci_pool_destroy(adapter->pthru_dma_pool);
1006 1003
1007 if (adapter) 1004 kfree(adapter);
1008 kfree(adapter);
1009 1005
1010 return rval; 1006 return rval;
1011} 1007}
@@ -1157,7 +1153,6 @@ mraid_mm_free_adp_resources(mraid_mmadp_t *adp)
1157 } 1153 }
1158 1154
1159 kfree(adp->kioc_list); 1155 kfree(adp->kioc_list);
1160
1161 kfree(adp->mbox_list); 1156 kfree(adp->mbox_list);
1162 1157
1163 pci_pool_destroy(adp->pthru_dma_pool); 1158 pci_pool_destroy(adp->pthru_dma_pool);
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 1cf11c3322fb..d9946bd95492 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -862,8 +862,7 @@ static int osst_recover_wait_frame(struct osst_tape * STp, struct scsi_request *
862 retval = osst_write_error_recovery(STp, aSRpnt, 0); 862 retval = osst_write_error_recovery(STp, aSRpnt, 0);
863 break; 863 break;
864 } 864 }
865 set_current_state(TASK_INTERRUPTIBLE); 865 schedule_timeout_interruptible(HZ / OSST_POLL_PER_SEC);
866 schedule_timeout (HZ / OSST_POLL_PER_SEC);
867 866
868 STp->buffer->b_data = mybuf; STp->buffer->buffer_size = 24; 867 STp->buffer->b_data = mybuf; STp->buffer->buffer_size = 24;
869 memset(cmd, 0, MAX_COMMAND_SIZE); 868 memset(cmd, 0, MAX_COMMAND_SIZE);
@@ -1558,8 +1557,7 @@ static int osst_reposition_and_retry(struct osst_tape * STp, struct scsi_request
1558 osst_set_frame_position(STp, aSRpnt, frame + skip, 1); 1557 osst_set_frame_position(STp, aSRpnt, frame + skip, 1);
1559 flag = 0; 1558 flag = 0;
1560 attempts--; 1559 attempts--;
1561 set_current_state(TASK_INTERRUPTIBLE); 1560 schedule_timeout_interruptible(msecs_to_jiffies(100));
1562 schedule_timeout(HZ / 10);
1563 } 1561 }
1564 if (osst_get_frame_position(STp, aSRpnt) < 0) { /* additional write error */ 1562 if (osst_get_frame_position(STp, aSRpnt) < 0) { /* additional write error */
1565#if DEBUG 1563#if DEBUG
@@ -1620,8 +1618,7 @@ static int osst_reposition_and_retry(struct osst_tape * STp, struct scsi_request
1620 debugging = 0; 1618 debugging = 0;
1621 } 1619 }
1622#endif 1620#endif
1623 set_current_state(TASK_INTERRUPTIBLE); 1621 schedule_timeout_interruptible(msecs_to_jiffies(100));
1624 schedule_timeout(HZ / 10);
1625 } 1622 }
1626 printk(KERN_ERR "%s:E: Failed to find valid tape media\n", name); 1623 printk(KERN_ERR "%s:E: Failed to find valid tape media\n", name);
1627#if DEBUG 1624#if DEBUG
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 290a6b92616c..72d9090df3df 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1977,8 +1977,7 @@ qla2x00_configure_local_loop(scsi_qla_host_t *ha)
1977 } 1977 }
1978 1978
1979cleanup_allocation: 1979cleanup_allocation:
1980 if (new_fcport) 1980 kfree(new_fcport);
1981 kfree(new_fcport);
1982 1981
1983 if (rval != QLA_SUCCESS) { 1982 if (rval != QLA_SUCCESS) {
1984 DEBUG2(printk("scsi(%ld): Configure local loop error exit: " 1983 DEBUG2(printk("scsi(%ld): Configure local loop error exit: "
@@ -2348,8 +2347,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2348 /* Allocate temporary fcport for any new fcports discovered. */ 2347 /* Allocate temporary fcport for any new fcports discovered. */
2349 new_fcport = qla2x00_alloc_fcport(ha, GFP_KERNEL); 2348 new_fcport = qla2x00_alloc_fcport(ha, GFP_KERNEL);
2350 if (new_fcport == NULL) { 2349 if (new_fcport == NULL) {
2351 if (swl) 2350 kfree(swl);
2352 kfree(swl);
2353 return (QLA_MEMORY_ALLOC_FAILED); 2351 return (QLA_MEMORY_ALLOC_FAILED);
2354 } 2352 }
2355 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED); 2353 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED);
@@ -2485,19 +2483,15 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2485 nxt_d_id.b24 = new_fcport->d_id.b24; 2483 nxt_d_id.b24 = new_fcport->d_id.b24;
2486 new_fcport = qla2x00_alloc_fcport(ha, GFP_KERNEL); 2484 new_fcport = qla2x00_alloc_fcport(ha, GFP_KERNEL);
2487 if (new_fcport == NULL) { 2485 if (new_fcport == NULL) {
2488 if (swl) 2486 kfree(swl);
2489 kfree(swl);
2490 return (QLA_MEMORY_ALLOC_FAILED); 2487 return (QLA_MEMORY_ALLOC_FAILED);
2491 } 2488 }
2492 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED); 2489 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED);
2493 new_fcport->d_id.b24 = nxt_d_id.b24; 2490 new_fcport->d_id.b24 = nxt_d_id.b24;
2494 } 2491 }
2495 2492
2496 if (swl) 2493 kfree(swl);
2497 kfree(swl); 2494 kfree(new_fcport);
2498
2499 if (new_fcport)
2500 kfree(new_fcport);
2501 2495
2502 if (!list_empty(new_fcports)) 2496 if (!list_empty(new_fcports))
2503 ha->device_flags |= DFLG_FABRIC_DEVICES; 2497 ha->device_flags |= DFLG_FABRIC_DEVICES;
diff --git a/drivers/scsi/raid_class.c b/drivers/scsi/raid_class.c
index f1ea5027865f..caa0c3629626 100644
--- a/drivers/scsi/raid_class.c
+++ b/drivers/scsi/raid_class.c
@@ -4,6 +4,8 @@
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/list.h> 6#include <linux/list.h>
7#include <linux/slab.h>
8#include <linux/string.h>
7#include <linux/raid_class.h> 9#include <linux/raid_class.h>
8#include <scsi/scsi_device.h> 10#include <scsi/scsi_device.h>
9#include <scsi/scsi_host.h> 11#include <scsi/scsi_host.h>
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 0cc766a9aa65..edabbd05d258 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -26,6 +26,8 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/slab.h>
30#include <linux/string.h>
29 31
30#include <scsi/scsi_device.h> 32#include <scsi/scsi_device.h>
31#include <scsi/scsi_host.h> 33#include <scsi/scsi_host.h>
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 4f30a37db63c..62e3f340cc52 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -476,8 +476,7 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
476 sg_finish_rem_req(srp); 476 sg_finish_rem_req(srp);
477 retval = count; 477 retval = count;
478free_old_hdr: 478free_old_hdr:
479 if (old_hdr) 479 kfree(old_hdr);
480 kfree(old_hdr);
481 return retval; 480 return retval;
482} 481}
483 482
@@ -1703,10 +1702,8 @@ exit_sg(void)
1703 sg_sysfs_valid = 0; 1702 sg_sysfs_valid = 0;
1704 unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), 1703 unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0),
1705 SG_MAX_DEVS); 1704 SG_MAX_DEVS);
1706 if (sg_dev_arr != NULL) { 1705 kfree((char *)sg_dev_arr);
1707 kfree((char *) sg_dev_arr); 1706 sg_dev_arr = NULL;
1708 sg_dev_arr = NULL;
1709 }
1710 sg_dev_max = 0; 1707 sg_dev_max = 0;
1711} 1708}
1712 1709
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 6b85f84c8397..770c4324f3d5 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4107,8 +4107,7 @@ out_free_tape:
4107 write_unlock(&st_dev_arr_lock); 4107 write_unlock(&st_dev_arr_lock);
4108out_put_disk: 4108out_put_disk:
4109 put_disk(disk); 4109 put_disk(disk);
4110 if (tpnt) 4110 kfree(tpnt);
4111 kfree(tpnt);
4112out_buffer_free: 4111out_buffer_free:
4113 kfree(buffer); 4112 kfree(buffer);
4114out: 4113out:
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index a1a58e1d5ad3..a7420cad4547 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -39,6 +39,7 @@
39 */ 39 */
40 40
41#include <linux/slab.h> 41#include <linux/slab.h>
42#include <asm/param.h> /* for timeouts in units of HZ */
42 43
43#include "sym_glue.h" 44#include "sym_glue.h"
44#include "sym_nvram.h" 45#include "sym_nvram.h"
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index cfab8f197084..1ce29ba683eb 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -1953,11 +1953,11 @@ static int u14_34f_release(struct Scsi_Host *shpnt) {
1953 1953
1954 for (j = 0; sh[j] != NULL && sh[j] != shpnt; j++); 1954 for (j = 0; sh[j] != NULL && sh[j] != shpnt; j++);
1955 1955
1956 if (sh[j] == NULL) panic("%s: release, invalid Scsi_Host pointer.\n", 1956 if (sh[j] == NULL)
1957 driver_name); 1957 panic("%s: release, invalid Scsi_Host pointer.\n", driver_name);
1958 1958
1959 for (i = 0; i < sh[j]->can_queue; i++) 1959 for (i = 0; i < sh[j]->can_queue; i++)
1960 if ((&HD(j)->cp[i])->sglist) kfree((&HD(j)->cp[i])->sglist); 1960 kfree((&HD(j)->cp[i])->sglist);
1961 1961
1962 for (i = 0; i < sh[j]->can_queue; i++) 1962 for (i = 0; i < sh[j]->can_queue; i++)
1963 pci_unmap_single(HD(j)->pdev, HD(j)->cp[i].cp_dma_addr, 1963 pci_unmap_single(HD(j)->pdev, HD(j)->cp[i].cp_dma_addr,
@@ -1965,7 +1965,8 @@ static int u14_34f_release(struct Scsi_Host *shpnt) {
1965 1965
1966 free_irq(sh[j]->irq, &sha[j]); 1966 free_irq(sh[j]->irq, &sha[j]);
1967 1967
1968 if (sh[j]->dma_channel != NO_DMA) free_dma(sh[j]->dma_channel); 1968 if (sh[j]->dma_channel != NO_DMA)
1969 free_dma(sh[j]->dma_channel);
1969 1970
1970 release_region(sh[j]->io_port, sh[j]->n_io_port); 1971 release_region(sh[j]->io_port, sh[j]->n_io_port);
1971 scsi_unregister(sh[j]); 1972 scsi_unregister(sh[j]);