Skip to content

Commit d04fc41

Browse files
Finn Thainmartinkpetersen
authored andcommitted
scsi: NCR5380: Unconditionally clear ICR after do_abort()
When do_abort() succeeds, the target will go to BUS FREE phase and there will be no connected command. Therefore, that function should clear the Initiator Command Register before returning. It already does so in case of NCR5380_poll_politely() failure; do the same for the other error case too, that is, NCR5380_transfer_pio() failure. Cc: Michael Schmitz <[email protected]> Cc: Ondrej Zary <[email protected]> Link: https://lore.kernel.org/r/4277b28ee2551f884aefa85965ef3c498344f301.1573875417.git.fthain@telegraphics.com.au Reviewed-and-tested-by: Michael Schmitz <[email protected]> Tested-by: Ondrej Zary <[email protected]> Signed-off-by: Finn Thain <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 350767f commit d04fc41

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/scsi/NCR5380.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ static void do_reset(struct Scsi_Host *instance)
13921392
* MESSAGE OUT phase and sending an ABORT message.
13931393
* @instance: relevant scsi host instance
13941394
*
1395-
* Returns 0 on success, -1 on failure.
1395+
* Returns 0 on success, negative error code on failure.
13961396
*/
13971397

13981398
static int do_abort(struct Scsi_Host *instance)
@@ -1417,7 +1417,7 @@ static int do_abort(struct Scsi_Host *instance)
14171417

14181418
rc = NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ, SR_REQ, 10 * HZ);
14191419
if (rc < 0)
1420-
goto timeout;
1420+
goto out;
14211421

14221422
tmp = NCR5380_read(STATUS_REG) & PHASE_MASK;
14231423

@@ -1428,7 +1428,7 @@ static int do_abort(struct Scsi_Host *instance)
14281428
ICR_BASE | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
14291429
rc = NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ, 0, 3 * HZ);
14301430
if (rc < 0)
1431-
goto timeout;
1431+
goto out;
14321432
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
14331433
}
14341434

@@ -1437,17 +1437,17 @@ static int do_abort(struct Scsi_Host *instance)
14371437
len = 1;
14381438
phase = PHASE_MSGOUT;
14391439
NCR5380_transfer_pio(instance, &phase, &len, &msgptr);
1440+
if (len)
1441+
rc = -ENXIO;
14401442

14411443
/*
14421444
* If we got here, and the command completed successfully,
14431445
* we're about to go into bus free state.
14441446
*/
14451447

1446-
return len ? -1 : 0;
1447-
1448-
timeout:
1448+
out:
14491449
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1450-
return -1;
1450+
return rc;
14511451
}
14521452

14531453
/*
@@ -2279,7 +2279,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
22792279
dsprintk(NDEBUG_ABORT, instance, "abort: cmd %p is connected\n", cmd);
22802280
hostdata->connected = NULL;
22812281
hostdata->dma_len = 0;
2282-
if (do_abort(instance)) {
2282+
if (do_abort(instance) < 0) {
22832283
set_host_byte(cmd, DID_ERROR);
22842284
complete_cmd(instance, cmd);
22852285
result = FAILED;

0 commit comments

Comments
 (0)