Commit 91402608 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Martin K. Petersen

scsi: pmcraid: fix lock imbalance in pmcraid_reset_reload()

sparse found a bug that has always been present since the driver was
merged:

drivers/scsi/pmcraid.c:2353:12: warning: context imbalance in 'pmcraid_reset_reload' - different lock contexts for basic block

Fix this by using a common unlock goto label, and also reduce the
indentation level in the function.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent c5ce0abe
...@@ -2373,25 +2373,22 @@ static int pmcraid_reset_reload( ...@@ -2373,25 +2373,22 @@ static int pmcraid_reset_reload(
spin_lock_irqsave(pinstance->host->host_lock, lock_flags); spin_lock_irqsave(pinstance->host->host_lock, lock_flags);
if (pinstance->ioa_state == IOA_STATE_DEAD) { if (pinstance->ioa_state == IOA_STATE_DEAD) {
spin_unlock_irqrestore(pinstance->host->host_lock,
lock_flags);
pmcraid_info("reset_reload: IOA is dead\n"); pmcraid_info("reset_reload: IOA is dead\n");
return reset; goto out_unlock;
} else if (pinstance->ioa_state == target_state) { }
if (pinstance->ioa_state == target_state) {
reset = 0; reset = 0;
goto out_unlock;
} }
} }
if (reset) {
pmcraid_info("reset_reload: proceeding with reset\n"); pmcraid_info("reset_reload: proceeding with reset\n");
scsi_block_requests(pinstance->host); scsi_block_requests(pinstance->host);
reset_cmd = pmcraid_get_free_cmd(pinstance); reset_cmd = pmcraid_get_free_cmd(pinstance);
if (reset_cmd == NULL) { if (reset_cmd == NULL) {
pmcraid_err("no free cmnd for reset_reload\n"); pmcraid_err("no free cmnd for reset_reload\n");
spin_unlock_irqrestore(pinstance->host->host_lock, goto out_unlock;
lock_flags);
return reset;
} }
if (shutdown_type == SHUTDOWN_NORMAL) if (shutdown_type == SHUTDOWN_NORMAL)
...@@ -2409,10 +2406,10 @@ static int pmcraid_reset_reload( ...@@ -2409,10 +2406,10 @@ static int pmcraid_reset_reload(
pmcraid_info("reset_reload: reset is complete !!\n"); pmcraid_info("reset_reload: reset is complete !!\n");
scsi_unblock_requests(pinstance->host); scsi_unblock_requests(pinstance->host);
if (pinstance->ioa_state == target_state) return pinstance->ioa_state != target_state;
reset = 0;
}
out_unlock:
spin_unlock_irqrestore(pinstance->host->host_lock, lock_flags);
return reset; return reset;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment