Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3754567pxk; Tue, 8 Sep 2020 01:17:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5QL4eLlTzU+5JGtc6Ns7XJIsfQg1KsjXTekk4nHYkLwiaqdimSLUjjwUy+HOpQgD/upcw X-Received: by 2002:a17:906:250a:: with SMTP id i10mr23970409ejb.202.1599553044912; Tue, 08 Sep 2020 01:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599553044; cv=none; d=google.com; s=arc-20160816; b=evFoMMenb19UFMq9oMDnIYLXv0iQ7c3Rfhb1PZo4QEVL6cCqXqScyAov8sLU5LqGF8 Fjv3EIu8ijHYfTRiM7yi9kMog7aVNkv5fQGjiEgi4/u4ueqMu/jXrZxTDecU0gfNZQQI rtfAA1fzFbftrN7k4rRpjNc7Lpx4NS6lx4xuKAG8qA14+BjV5j0rb+H2YAK1lXpp0PJh uJSV9wQWo+nyPr3SceTksAuGKHammCLkjQS/RwH6fG6vvRmcvYJALD0lM2dPy7NMxjR8 lzyvVJmNP5nMUQbUWhHhjqXUdM0UCAZI0mp9nxRHg09yCqbevSHl1hhDAVaXGpVhgeaL dk+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=kGOv7bYBf3bNCwqDPNFHv8PqNonwQzzw0yXB+wGy4vI=; b=eaquJU587RD+x0YyiaDym+qfDsmc9ZeFYF06FLCZD+SiWoW3aXMRDr5IaYY5bXriqU ctZ41d8vvQpQ6nCsMHlw+EBbRPRw80csqgQgKvuKxx0nUB10TqUsgCSiq78wacbwJk8+ xl1qdRJl9oR4M0ohY4xkEwuUGi7oc92tyoM4bcMgVK8Gw5/K0Yo18Ksa1W0BNA1EM+ES s3dYl/jKch94nYcI6zVU3bjXXR4KUeb6ycnM81bqCtP8ycdJtjJIFdgP1fOruRSXtLWS 0PxYQO6P/h0rcXcLfVSHpxxenQpj3UP/cD5+U+bN5Re1TglTCrvFV8WNQFVgE7FKv6Zo niaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw21si1190478ejb.392.2020.09.08.01.17.02; Tue, 08 Sep 2020 01:17:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729871AbgIHIPa (ORCPT + 99 others); Tue, 8 Sep 2020 04:15:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:37128 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729626AbgIHIPZ (ORCPT ); Tue, 8 Sep 2020 04:15:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3B48DB691; Tue, 8 Sep 2020 08:15:24 +0000 (UTC) From: Daniel Wagner To: linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Nilesh Javali , Martin Wilck , Arun Easi , Daniel Wagner Subject: [PATCH v3 2/4] qla2xxx: Simplify return value logic in qla2x00_get_sp_from_handle() Date: Tue, 8 Sep 2020 10:15:14 +0200 Message-Id: <20200908081516.8561-3-dwagner@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200908081516.8561-1-dwagner@suse.de> References: <20200908081516.8561-1-dwagner@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Refactor qla2x00_get_sp_from_handle() to avoid the unecessary goto if early returns are used. With this we can also avoid preinitilzing the sp pointer. Reviewed-by: Martin Wilck Signed-off-by: Daniel Wagner --- drivers/scsi/qla2xxx/qla_isr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 27bcd346af7c..5d278155e4e7 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -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; } -- 2.16.4