[SCSI] libfc: Return a valid return code in fc_fcp_pkt_abort()
[pandora-kernel.git] / drivers / scsi / libfc / fc_fcp.c
index cdc06cd..ba639fa 100644 (file)
@@ -155,6 +155,7 @@ static struct fc_fcp_pkt *fc_fcp_pkt_alloc(struct fc_lport *lport, gfp_t gfp)
        if (fsp) {
                memset(fsp, 0, sizeof(*fsp));
                fsp->lp = lport;
+               fsp->xfer_ddp = FC_XID_UNKNOWN;
                atomic_set(&fsp->ref_cnt, 1);
                init_timer(&fsp->timer);
                INIT_LIST_HEAD(&fsp->list);
@@ -1201,6 +1202,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;
@@ -1209,13 +1211,13 @@ static int fc_fcp_pkt_abort(struct fc_fcp_pkt *fsp)
        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;
@@ -1250,7 +1252,7 @@ static void fc_lun_reset_send(unsigned long data)
 /**
  * fc_lun_reset() - Send a LUN RESET command to a device
  *                 and wait for the reply
- * @lport: The local port to sent the comand on
+ * @lport: The local port to sent the command on
  * @fsp:   The FCP packet that identifies the LUN to be reset
  * @id:           The SCSI command ID
  * @lun:   The LUN ID to be reset
@@ -1842,9 +1844,7 @@ static int fc_queuecommand_lck(struct scsi_cmnd *sc_cmd, void (*done)(struct scs
         * build the libfc request pkt
         */
        fsp->cmd = sc_cmd;      /* save the cmd */
-       fsp->lp = lport;        /* save the softc ptr */
        fsp->rport = rport;     /* set the remote port ptr */
-       fsp->xfer_ddp = FC_XID_UNKNOWN;
        sc_cmd->scsi_done = done;
 
        /*
@@ -2112,7 +2112,6 @@ int fc_eh_device_reset(struct scsi_cmnd *sc_cmd)
         * the sc passed in is not setup for execution like when sent
         * through the queuecommand callout.
         */
-       fsp->lp = lport;        /* save the softc ptr */
        fsp->rport = rport;     /* set the remote port ptr */
 
        /*