From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752668AbdLKKmX (ORCPT ); Mon, 11 Dec 2017 05:42:23 -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 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-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- 2.15.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Mon, 11 Dec 2017 10:42:12 +0000 Subject: [PATCH 1/6] target: tcm_loop: Delete an error message for a failed memory allocation in four functio Message-Id: List-Id: References: <42f13f0c-ae1d-ec1e-fd9d-62dd15aeba8c@users.sourceforge.net> In-Reply-To: <42f13f0c-ae1d-ec1e-fd9d-62dd15aeba8c@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, Bart Van Assche , "Nicholas A. Bellinger" Cc: LKML , kernel-janitors@vger.kernel.org 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. -- 2.15.1