Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1144755ybi; Fri, 2 Aug 2019 10:02:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEor9TVKszdVI/fOV0/MOmj7qsM8pOLFv5AG9tweyuZPRjXRRQJr96BotG9js7rQxGLKWR X-Received: by 2002:a17:902:8d97:: with SMTP id v23mr129043658plo.157.1564765331665; Fri, 02 Aug 2019 10:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564765331; cv=none; d=google.com; s=arc-20160816; b=ayKKVgcL7c42zz0K1x1ZuUL1OL7QAJN+4uAlQUMuvknHY+UyuzA20LKVte4URQiX4a auqqfOo63pYK2xKV8HetWgNTNyULFayBpLArNZLDcKGhJZQPyv7Y7+JgKy7KcoI4Abn1 ztf+pj0ZvPjuhEQnz5Ef7kcOODmkiTfWZ42rmyaYLKnoJOfnRL+bLpfAYXoC6d15e719 AQa+GG9iOhZndjciw5ih68Rbb70J+Rd15LFo1LbYQxDSigKogYMVjdL3CDSPlXZ6BGtR e7UE/Xk4sZ8eC6w0l8UTPjvadC4r9zCC95qVsXSyLlj/UaqQ73B2urjLoTCg2vysZn08 dO9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IaI2QJBQIYF8lMWBmwanTMwBa5yvNrFMgPnxaDQJ9RU=; b=fjFrtnI4uviYSKd8/AG19ORDQ220U0q/Ykoh0qr9gdMfGqlDULMYfNptTe+ECe1uYt LefQj4f898QgT1F4/DEUvMTmRQWcwrLB8cNuhExBLRYyXRhH5lw90mgQ3FbvENwyNsti MOQdZCxtsOHwcrtLnjtQ+1HL3TFClazWEYp9X04b3FSWjK554AzC3pG9TdVFIx8lEEx9 iB+Pdk+Uh0km4VoA+z5EXGfNYXtsET1yqCqGQAXIl6eWnUvX9gut4Vn2rLIoyw7IQcKp NueNRg53+uHS0TZqfSCgwQcMc3/s8rhDtEua0v1um0605hNjeoM81eUhwZTpzAVjXMQx pI0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IOV54WcE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si35061653pls.233.2019.08.02.10.01.56; Fri, 02 Aug 2019 10:02:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IOV54WcE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404015AbfHBJoT (ORCPT + 99 others); Fri, 2 Aug 2019 05:44:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:46004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391488AbfHBJnM (ORCPT ); Fri, 2 Aug 2019 05:43:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CCB112086A; Fri, 2 Aug 2019 09:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564738992; bh=9eaYUajJCWUORYIELbRhhwap7w2FWbuSby3EDs7IJEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOV54WcEcqMp5K9TJqCqm3f4yTtvTVRxzKV8R/qmkYJJtximGhWBOGe74i00qQjit mEZQ7vIK3vS8F3SbhRwGu4JR55Xq/tYsywZz8D+bXI2tjVjq+sAAkafwBUTygzH+8i zBH3VvPuF/aZfXYJbfRFR1pISulGELKX6VadEUSY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Schmitz , Finn Thain , "Martin K. Petersen" Subject: [PATCH 4.9 075/223] scsi: NCR5380: Reduce goto statements in NCR5380_select() Date: Fri, 2 Aug 2019 11:35:00 +0200 Message-Id: <20190802092243.696800783@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Finn Thain commit 6a162836997c10bbefb7c7ca772201cc45c0e4a6 upstream. Replace a 'goto' statement with a simple 'return' where possible. This improves readability. No functional change. Tested-by: Michael Schmitz Signed-off-by: Finn Thain Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/NCR5380.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -1086,7 +1086,7 @@ static struct scsi_cmnd *NCR5380_select( if (!hostdata->selecting) { /* Command was aborted */ NCR5380_write(MODE_REG, MR_BASE); - goto out; + return NULL; } if (err < 0) { NCR5380_write(MODE_REG, MR_BASE); @@ -1135,7 +1135,7 @@ static struct scsi_cmnd *NCR5380_select( if (!hostdata->selecting) { NCR5380_write(MODE_REG, MR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); - goto out; + return NULL; } dsprintk(NDEBUG_ARBITRATION, instance, "won arbitration\n"); @@ -1218,13 +1218,16 @@ static struct scsi_cmnd *NCR5380_select( spin_lock_irq(&hostdata->lock); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); + /* Can't touch cmd if it has been reclaimed by the scsi ML */ - if (hostdata->selecting) { - cmd->result = DID_BAD_TARGET << 16; - complete_cmd(instance, cmd); - dsprintk(NDEBUG_SELECTION, instance, "target did not respond within 250ms\n"); - cmd = NULL; - } + if (!hostdata->selecting) + return NULL; + + cmd->result = DID_BAD_TARGET << 16; + complete_cmd(instance, cmd); + dsprintk(NDEBUG_SELECTION, instance, + "target did not respond within 250ms\n"); + cmd = NULL; goto out; } @@ -1257,7 +1260,7 @@ static struct scsi_cmnd *NCR5380_select( } if (!hostdata->selecting) { do_abort(instance); - goto out; + return NULL; } dsprintk(NDEBUG_SELECTION, instance, "target %d selected, going into MESSAGE OUT phase.\n",