Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3992542ybi; Mon, 29 Jul 2019 17:03:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhlDgkYzoTX3ibLguOZjEy2aGtjZ3Uv0REUcHVB0jDe9eXWelauLge3PcgM2NPLHsNeUTD X-Received: by 2002:a17:902:b582:: with SMTP id a2mr114569180pls.128.1564445032659; Mon, 29 Jul 2019 17:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564445032; cv=none; d=google.com; s=arc-20160816; b=oz3zOqjiXyLVcynIKYf9J6KWc0eRjk1qc2VbMKuJOuQpzmHPHqsMJndbk6VwWm3wAz QP/dJ2HVJj2dan5hgNwV80xAuACYuu1iJxd41GGP1XQhISIf0ryFw2hBH1EubhZ+M7Nj 2YxtPf+UFPcr3mO73E53bd96VjqYPKfRmA4dl6uxK2C+CT2a9Tj5vvQC0toYEVK8Fygb seUaad5RiezvYWXB3gHCRRqFyJUm7h8O4y07+VIbDRSn5qMBi7Yo0sKiIe1d16u9YKAz Zq+KnrJDfC/kCPao9KuaRneZQzN/IdP7hsm4b/nc+uAOrw+uNy3ag8BiKRUcJSkeHWOt xxAA== 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=FNzME6PM1jPmbmTBsocTldJ2K9saI8yLxboFTUOgsRo=; b=ObJKU41bvrTKGcYOzWMOTjdCVi/Kl/Sndyk+s3px7AWiKv43aCGmB6mepwKjeQwvbT 2guLHM7XPt+Oa3KXM7z+Lo/eolDxQ41OoCr4Z/vjpfj4J38KE8ryR8gUG6RXTX0LKy2Q CRdV6JY90nkwMI7K/kVyPe/RRaX9I7C9OpqThkJ0cd7uErkijkqff/8cqYD26nx/kvLK QhACX2/M671oZiEq/zMa4E9ZIBgApHAsN4PCpkOUkYrA7/k6d9VqtX8TynRtjS4E2Cbu R+XX9ymTFZ5zZS9+Fq9hbWoWQW4+4/3t4YSQg+sPf4Q/qWl8AR+ltCfmcNZt5drYLf3z DSWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2nPKV4F+; 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 v71si28607616pgd.468.2019.07.29.17.03.26; Mon, 29 Jul 2019 17:03:52 -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=2nPKV4F+; 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 S1730084AbfG2T3N (ORCPT + 99 others); Mon, 29 Jul 2019 15:29:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:41866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730077AbfG2T3J (ORCPT ); Mon, 29 Jul 2019 15:29:09 -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 922E3217D4; Mon, 29 Jul 2019 19:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428549; bh=LBngP+SYDecVYiJm+t3k/6UP2RSu5ScY0G4AkJwtVNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2nPKV4F+xfMdbK3U6eaEngElL3Eu5sOtqCGMHQLuu8mPOV99EaHUG2NuoTJkOKoyQ 6XIa+Vo9tZcQE1Q13xNYo3rHm7ystFgRsthSSpHMEDCCA/rZd9cbu8+GoBTM4QDb/h AlF6tX/9JdbN1TodfNjknwwxTOFErMTRQOhS+k0I= 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.14 112/293] scsi: NCR5380: Reduce goto statements in NCR5380_select() Date: Mon, 29 Jul 2019 21:20:03 +0200 Message-Id: <20190729190833.219059030@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 @@ -984,7 +984,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); @@ -1033,7 +1033,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"); @@ -1116,13 +1116,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; } @@ -1155,7 +1158,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",