From patchwork Mon Dec 11 10:42:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10104689 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 29678602D8 for ; Mon, 11 Dec 2017 10:42:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33D342953C for ; Mon, 11 Dec 2017 10:42:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27F772953E; Mon, 11 Dec 2017 10:42:22 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 C058C2953C for ; Mon, 11 Dec 2017 10:42:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752550AbdLKKmU (ORCPT ); Mon, 11 Dec 2017 05:42:20 -0500 Received: from mout.web.de ([217.72.192.78]:62353 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956AbdLKKmS (ORCPT ); Mon, 11 Dec 2017 05:42:18 -0500 Received: from [192.168.1.3] ([92.227.98.61]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MKJ7S-1eMhdr1QF4-001jL5; Mon, 11 Dec 2017 11:42:13 +0100 Subject: [PATCH 1/6] target: tcm_loop: Delete an error message for a failed memory allocation in four functions From: SF Markus Elfring To: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, Bart Van Assche , "Nicholas A. Bellinger" Cc: LKML , kernel-janitors@vger.kernel.org References: <42f13f0c-ae1d-ec1e-fd9d-62dd15aeba8c@users.sourceforge.net> Message-ID: Date: Mon, 11 Dec 2017 11:42:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <42f13f0c-ae1d-ec1e-fd9d-62dd15aeba8c@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:QbaqzIVAIWrA2zEBah7Y9RDZ+ATMNrzz+U4XK+5A1rDPsugYWgO VDkfmWMYi/3ZuHymzhCAIq6UBA0Y+QvGd0lI1nwbszq1lQqdg89/quQ6hHMuFyl4uGQ0zOR AzJQUt9K7/dHAkpgeqBAcCTjScrv5Oy2TEcA3Q5CBd9/ImV/KinKeWJSizEM5DrSFz2Gc4R kkla1bQar5gt0q7BBqWWA== X-UI-Out-Filterresults: notjunk:1; V01:K0:5qlubH1HwpM=:lLjAhKiMqMYDOTvPeGoHLg 0hk21/Z3NsN9/wdbmRseO2hfV1MnWLy/11xoZb8paIq0/a9n7f/ATpT+5gl9GU7qzKjGPM0qO UOf32DBhgY8xwl1MqmYqiY6Hr8dB13QGfymBp4GCPXP2ycRi7hVS41AGOSGxz6eRIeAdfrcDe U4T8TllMfaD0QinHmd7q+5GwsRY7vZoY+ov5YjNSagil/eUpaIpKigGjxL7elxZmYLjDAMXRk VAX8fKgcIwix22ufrkpEhBCU4fqG4ojc2YIhl1tZ+p2/CKFlUB6Ss+w9PeSeMQUxQRYrExMkh sPwxqirHWl7hjfy2AT7VcDOim4la/ZP+Xr0KzW0IBsrFacezZdLm6T21f32HxElb/0sXgCD1m drA1wI5Ew6LWsK4QN5YZayo+YFet/q/f6L7Hf/0kUIXDct/A6JANXEs0e4B3y/eIVv+9cr9fx UZ2ICMhk3rBjFq9IG3Dy16r8M0xZOAftuMybQ17gvukWWhSrUXubX0bFkRBIMZPI6TYkJ9xDv 7QDERBZMEB+5zQi8o3/kDQERzITFff8T3qa70PcNqxKRksa4sgTGAYrIw0DK+4t2+iUeunV0w f5VyFARGCCptN4zI/G+We+EG7oOP54rPZJjphW+cZEsxx9Zk2EwML5zcR7lb3+JFlQBerLwrw 4J5OHT6rK1ngmkkWLMdrgGq2KcyCCxce+nqOzCYcT+0/5FQO65wntyg+2JTvl1J+iJfixbvrS Qlv770ipCU4x0+f0XtxRwxgyQuY5GdBP6UH3hFEt/is/PYg0P9h+jNRlxnjynDL/45LdhZpi1 B3Sa3swVc0OTPKI0NB+TuzbyoI88mbJySy7m8D1dtAnpmvHIAo= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 10 Dec 2017 21:18:15 +0100 Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/target/loopback/tcm_loop.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index b6a913e38b30..6bd58a064924 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -184,7 +184,6 @@ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_ATOMIC); if (!tl_cmd) { - pr_err("Unable to allocate struct tcm_loop_cmd\n"); set_host_byte(sc, DID_ERROR); sc->scsi_done(sc); return 0; @@ -221,10 +220,8 @@ static int tcm_loop_issue_tmr(struct tcm_loop_tpg *tl_tpg, } tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_KERNEL); - if (!tl_cmd) { - pr_err("Unable to allocate memory for tl_cmd\n"); + if (!tl_cmd) return ret; - } init_completion(&tl_cmd->tmr_done); @@ -773,10 +770,8 @@ static int tcm_loop_make_nexus( } tl_nexus = kzalloc(sizeof(struct tcm_loop_nexus), GFP_KERNEL); - if (!tl_nexus) { - pr_err("Unable to allocate struct tcm_loop_nexus\n"); + if (!tl_nexus) return -ENOMEM; - } tl_nexus->se_sess = target_alloc_session(&tl_tpg->tl_se_tpg, 0, 0, TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS, @@ -1082,10 +1077,9 @@ static struct se_wwn *tcm_loop_make_scsi_hba( int ret, off = 0; tl_hba = kzalloc(sizeof(struct tcm_loop_hba), GFP_KERNEL); - if (!tl_hba) { - pr_err("Unable to allocate struct tcm_loop_hba\n"); + if (!tl_hba) return ERR_PTR(-ENOMEM); - } + /* * Determine the emulated Protocol Identifier and Target Port Name * based on the incoming configfs directory name.