[PATCH] fix megaraid.c locking

This fixes locking in megaraid.c, namely:

(1) make sure megaraid_queue release the adapter lock by changing the
code to have a single return
(2) remove the errornous scsi_assign_lock call

Testing by Burton Windle.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Burton Windle <bwindle@fint.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Christoph Hellwig and committed by Linus Torvalds 238f9b06 238f58d8

+14 -15
+14 -15
drivers/scsi/megaraid.c
··· 380 380 381 381 spin_lock_irqsave(&adapter->lock, flags); 382 382 scb = mega_build_cmd(adapter, scmd, &busy); 383 + if (!scb) 384 + goto out; 383 385 384 - if(scb) { 385 - scb->state |= SCB_PENDQ; 386 - list_add_tail(&scb->list, &adapter->pending_list); 386 + scb->state |= SCB_PENDQ; 387 + list_add_tail(&scb->list, &adapter->pending_list); 387 388 388 - /* 389 - * Check if the HBA is in quiescent state, e.g., during a 390 - * delete logical drive opertion. If it is, don't run 391 - * the pending_list. 392 - */ 393 - if(atomic_read(&adapter->quiescent) == 0) { 394 - mega_runpendq(adapter); 395 - } 396 - return 0; 397 - } 389 + /* 390 + * Check if the HBA is in quiescent state, e.g., during a 391 + * delete logical drive opertion. If it is, don't run 392 + * the pending_list. 393 + */ 394 + if (atomic_read(&adapter->quiescent) == 0) 395 + mega_runpendq(adapter); 396 + 397 + busy = 0; 398 + out: 398 399 spin_unlock_irqrestore(&adapter->lock, flags); 399 - 400 400 return busy; 401 401 } 402 402 ··· 4677 4677 4678 4678 adapter->flag = flag; 4679 4679 spin_lock_init(&adapter->lock); 4680 - scsi_assign_lock(host, &adapter->lock); 4681 4680 4682 4681 host->cmd_per_lun = max_cmd_per_lun; 4683 4682 host->max_sectors = max_sectors_per_io;