Here ticks_left is added to record the result of wait_for_completion_timeout().

The advantage looks that it is not only clearer but necessary also to
remove any chaos in what is returned.

Signed-off-by: Hillf Danton <[email protected]>
---

--- a/drivers/scsi/libfc/fc_fcp.c       2010-11-01 19:54:12.000000000 +0800
+++ b/drivers/scsi/libfc/fc_fcp.c       2010-12-03 21:57:12.000000000 +0800
@@ -1165,6 +1165,7 @@ unlock:
 static int fc_fcp_pkt_abort(struct fc_fcp_pkt *fsp)
 {
        int rc = FAILED;
+       unsigned long ticks_left;

        if (fc_fcp_send_abort(fsp))
                return FAILED;
@@ -1173,13 +1174,13 @@ static int fc_fcp_pkt_abort(struct fc_fc
        fsp->wait_for_comp = 1;

        spin_unlock_bh(&fsp->scsi_pkt_lock);
-       rc = wait_for_completion_timeout(&fsp->tm_done, FC_SCSI_TM_TOV);
+       ticks_left = wait_for_completion_timeout(&fsp->tm_done,
+                                                       FC_SCSI_TM_TOV);
        spin_lock_bh(&fsp->scsi_pkt_lock);
        fsp->wait_for_comp = 0;

-       if (!rc) {
+       if (! ticks_left) {
                FC_FCP_DBG(fsp, "target abort cmd  failed\n");
-               rc = FAILED;
        } else if (fsp->state & FC_SRB_ABORTED) {
                FC_FCP_DBG(fsp, "target abort cmd  passed\n");
                rc = SUCCESS;
_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to