scsi: qla2xxx: Simplify return value logic in qla2x00_get_sp_from_handle()
authorDaniel Wagner <dwagner@suse.de>
Tue, 8 Sep 2020 08:15:14 +0000 (10:15 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 10 Sep 2020 02:01:43 +0000 (22:01 -0400)
Refactor qla2x00_get_sp_from_handle() to avoid the unnecessary goto if
early returns are used. With this we can also avoid preinitialzing the sp
pointer.

Link: https://lore.kernel.org/r/20200908081516.8561-3-dwagner@suse.de
Reviewed-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_isr.c

index 27bcd346af7c2530c0cb147d897e0bdf13d25bb8..5d278155e4e769cfd27fa086da36255ac12a0954 100644 (file)
@@ -1716,7 +1716,7 @@ qla2x00_get_sp_from_handle(scsi_qla_host_t *vha, const char *func,
 {
        struct qla_hw_data *ha = vha->hw;
        sts_entry_t *pkt = iocb;
-       srb_t *sp = NULL;
+       srb_t *sp;
        uint16_t index;
 
        index = LSW(pkt->handle);
@@ -1728,13 +1728,13 @@ qla2x00_get_sp_from_handle(scsi_qla_host_t *vha, const char *func,
                        set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
                else
                        set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
-               goto done;
+               return NULL;
        }
        sp = req->outstanding_cmds[index];
        if (!sp) {
                ql_log(ql_log_warn, vha, 0x5032,
                    "Invalid completion handle (%x) -- timed-out.\n", index);
-               return sp;
+               return NULL;
        }
        if (sp->handle != index) {
                ql_log(ql_log_warn, vha, 0x5033,
@@ -1743,8 +1743,6 @@ qla2x00_get_sp_from_handle(scsi_qla_host_t *vha, const char *func,
        }
 
        req->outstanding_cmds[index] = NULL;
-
-done:
        return sp;
 }