From patchwork Fri Jun 22 21:53:03 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: 10483123 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 E4A1260383 for ; Fri, 22 Jun 2018 21:53:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2BF529043 for ; Fri, 22 Jun 2018 21:53:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7B7229044; Fri, 22 Jun 2018 21:53:20 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 6D3142903B for ; Fri, 22 Jun 2018 21:53:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754557AbeFVVxT (ORCPT ); Fri, 22 Jun 2018 17:53:19 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:64357 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754240AbeFVVxO (ORCPT ); Fri, 22 Jun 2018 17:53:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1529704422; x=1561240422; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=bxSBD858EC4zzNOhquGvXxpsNA74yHEuEkeXtX4mnN0=; b=qE2eyjQtQC2C1rdXZaiOUOno09JooBCKHJEPODJcQR8k3zyP+CdUj4vb 3VuIolDHRZ7j5LMgWZHv6jzXKeROY6WqQATUwSDyenw8NU0W3/8Zxke2k hEVX0BsQyH8kuv2/UZLPO8MFwoSSt1Wds6fb6eI9SZ9hfuV9sHubNOFsS PxBl4CN3MonS54oxFORjEx4KZz8uH4EsmqFsbnmhG4GPeeZS1Ofx1TVZM +J3ykoWjapI1UDPyYFwK+WwdA+Sptyhk+kVUA4UMIWdgJWIf7Id0vFOcU gF0jdEirnGL0cuPHRoeJglTfCsE3A3WZBBYDXVwaw53Pbru6mgx+wiEzm Q==; X-IronPort-AV: E=Sophos;i="5.51,259,1526313600"; d="scan'208";a="178351020" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Jun 2018 05:53:38 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 22 Jun 2018 14:42:58 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 22 Jun 2018 14:53:12 -0700 From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Dan Carpenter , Hannes Reinecke Subject: [PATCH 16/20] target/tcm_loop: Avoid that static checkers warn about dead code Date: Fri, 22 Jun 2018 14:53:03 -0700 Message-Id: <20180622215307.8758-17-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180622215307.8758-1-bart.vanassche@wdc.com> References: <20180622215307.8758-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 The code under the "release:" label can only be reached after se_cmd has been set to a non-NULL value. Hence remove the if (se_cmd) test. Keep the else-part since calling transport_generic_free_cmd() is not necessary for a command that has not been submitted to the core. Reported-by: Dan Carpenter Fixes: 4d3895d5ea43 ("target/tcm_loop: Merge struct tcm_loop_cmd and struct tcm_loop_tmr") Signed-off-by: Bart Van Assche Reviewed-by: Mike Christie Cc: Dan Carpenter Cc: Hannes Reinecke Cc: Christoph Hellwig --- drivers/target/loopback/tcm_loop.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 4c8a97711291..b2e7ff50ff61 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -239,10 +239,7 @@ static int tcm_loop_issue_tmr(struct tcm_loop_tpg *tl_tpg, return ret; release: - if (se_cmd) - transport_generic_free_cmd(se_cmd, 0); - else - kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); + kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); goto out; }