Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10424601ybi; Wed, 24 Jul 2019 22:59:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxk5xqT3JdWlyGJnuYfGciXn9pMCGfPaNi6eVoLYlhFaYmIZPT3MXlz5lfGKvAUAUq60A7z X-Received: by 2002:a63:6154:: with SMTP id v81mr51567708pgb.296.1564034386401; Wed, 24 Jul 2019 22:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034386; cv=none; d=google.com; s=arc-20160816; b=eF5A+j21RbKUV7e4ZL8Ljnn9FeMw2GRGSNiItVMQxoSvNPGq+QOIJT9Y/1ijM6WGYS dikXT5sFRZ/t2JkqNm9mURjPQ8jwjc5PU6HFh5N1122naNdIRM20kVESm3/pkopobJkB qFMCVkmanHoYQ0CRfp0qEK9XIU1Q3NmmyspyRqCqgVTue+4F0PRQq5rStsAxSXEV+GnO zTURN2YLGWa5Q1514ReZdd5fadmCEoK7OFNAbiXyIGLcdX8zledkkcsssQJYeedcRYqi HQ0nh7Ewo5GcQTJLPVz3YnU+8Ds4nawDcjAmqChEKZOl2/0YHJ2gmh1MVcE0qajbNp1+ QsuQ== 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=uV+dnqpYj2EQyw4fmEuT/5rduuJgK6g1byJ85S6jIqqDkJRGoH5GhCFRy5PLrwi6HB ub4UiGdnvDdgxA/83s5hk6MAuYvwrhalq8aJk03Vga5CI/Xug6vmTCYj59tdnpzr6Ucq 16jtLMK11xGCobp7MVcNhs2RkqpQQMCcamdfZZh7MmDMj9GlfH5UgfadQj4iyq3RrqUo YFQ647/FgPxJvFrj+C2vGkuQyi5MY8QfiEZfdC8YSoiAoMxKgOhdpogtWXjtRHrXuk1B y2QDrzVwHltCBNk/+8GXcQgLbKuyvfSBUw9vA/IFzUa41YfIvl0eyoS1wHg/HJ96+ssD AucA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MDmI++po; 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 m5si14389511plt.167.2019.07.24.22.59.31; Wed, 24 Jul 2019 22:59:46 -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=MDmI++po; 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 S2404799AbfGYFmB (ORCPT + 99 others); Thu, 25 Jul 2019 01:42:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:56840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404736AbfGYFl7 (ORCPT ); Thu, 25 Jul 2019 01:41:59 -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 C2C052075C; Thu, 25 Jul 2019 05:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033318; bh=LBngP+SYDecVYiJm+t3k/6UP2RSu5ScY0G4AkJwtVNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MDmI++poRkEFSX8ic7mbyaJsZA+E3ZyLx+TFzCkgtX0Ly/jX0GstxBDDMOsBLh2iu B1+rKmBa6t4H66lsJOzxYal4iME15p3tjFI/1vAS/+jE6RMgCAsa/ByTEnz/7RDLBC g0J3f+oWtxl8vpYYdPheXN29AXELTjGg2+J2gUYU= 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.19 165/271] scsi: NCR5380: Reduce goto statements in NCR5380_select() Date: Wed, 24 Jul 2019 21:20:34 +0200 Message-Id: <20190724191709.320954138@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@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",