From patchwork Thu Mar 1 22:26:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10252751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4662860365 for ; Thu, 1 Mar 2018 22:26:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 378A327816 for ; Thu, 1 Mar 2018 22:26:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C590286A9; Thu, 1 Mar 2018 22:26:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CED6227816 for ; Thu, 1 Mar 2018 22:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162592AbeCAW0l (ORCPT ); Thu, 1 Mar 2018 17:26:41 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:41196 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162580AbeCAW0i (ORCPT ); Thu, 1 Mar 2018 17:26:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1519943199; x=1551479199; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=zNp706WRffOKbaVOsAG3NHuylXq5zaLSYCNTtXLZ23c=; b=MpNq6M1uZgsK3mpiRouRv9zgUweGPGtm1NxUUqMxApFKyywX9UgFmh7I nFZcAvHjGZaCQqOtqPd6vhjuJgByy2RMRz3ozg+H0hxJ4dZZoi6uEoEr0 pFIuEBTtrTEJ26+ncabbwfsMc4+63yAieFD0J1uPO+yXbQv0ptBmshkxR zNl4ghKFize+STwB4V4MD6nCfRw3JsDJqmCHncMpWoU/Hf1fkEgtB3PAx 2bjUcWnzvP+FpQGM864FIBL6cuY98AkDytikiKVV+wfUsjAQ7QHBw9lDl vGFri3UM4uk/bjAVZZFfGVfZ9eEn6O0dx7GnQvq+qWZTsiTydTO55bEzT A==; X-IronPort-AV: E=Sophos;i="5.47,409,1515427200"; d="scan'208";a="72564599" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 02 Mar 2018 06:26:35 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 01 Mar 2018 14:20:38 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip01.wdc.com with ESMTP; 01 Mar 2018 14:26:35 -0800 From: Bart Van Assche To: Nicholas Bellinger Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Hannes Reinecke , Mike Christie Subject: [PATCH 08/14] target: Simplify transport_generic_free_cmd() (1/2) Date: Thu, 1 Mar 2018 14:26:26 -0800 Message-Id: <20180301222632.31507-9-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180301222632.31507-1-bart.vanassche@wdc.com> References: <20180301222632.31507-1-bart.vanassche@wdc.com> Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move identical code outside an if/else statement. This patch does not change any functionality. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Mike Christie --- drivers/target/target_core_transport.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 7eb55e6b5831..92682400995e 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2602,9 +2602,6 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) { if (wait_for_tasks && (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) target_wait_free_cmd(cmd, &aborted, &tas); - - if (!aborted || tas) - ret = target_put_sess_cmd(cmd); } else { if (wait_for_tasks) target_wait_free_cmd(cmd, &aborted, &tas); @@ -2618,10 +2615,9 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) if (cmd->se_lun) transport_lun_remove_cmd(cmd); - - if (!aborted || tas) - ret = target_put_sess_cmd(cmd); } + if (!aborted || tas) + ret = target_put_sess_cmd(cmd); if (aborted) { pr_debug("Detected CMD_T_ABORTED for ITT: %llu\n", cmd->tag); wait_for_completion(&cmd->cmd_wait_comp);