From 6c052abd82c0e15c871fe5c131ca7ee687d3fc9c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 28 Dec 2020 19:09:41 +0000 Subject: [PATCH] qla2x00t-32gbit: Simplify return value logic in qla2x00_get_sp_from_handle() 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 Reviewed-by: Arun Easi Signed-off-by: Daniel Wagner Signed-off-by: Martin K. Petersen See also upstream commit 622299f16f33852baddf94b32bc80e2c1e24c39a. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9250 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_isr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/qla2x00t-32gbit/qla_isr.c b/qla2x00t-32gbit/qla_isr.c index 4323b97b0..5ef9c7ea4 100644 --- a/qla2x00t-32gbit/qla_isr.c +++ b/qla2x00t-32gbit/qla_isr.c @@ -1728,7 +1728,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); @@ -1740,13 +1740,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, @@ -1755,8 +1755,6 @@ qla2x00_get_sp_from_handle(scsi_qla_host_t *vha, const char *func, } req->outstanding_cmds[index] = NULL; - -done: return sp; }