From patchwork Sat Nov 4 13:18:59 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: 10041583 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 6347D60384 for ; Sat, 4 Nov 2017 13:19:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52821294FB for ; Sat, 4 Nov 2017 13:19:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4737E295F4; Sat, 4 Nov 2017 13:19:05 +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 E2871294FB for ; Sat, 4 Nov 2017 13:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752169AbdKDNTE (ORCPT ); Sat, 4 Nov 2017 09:19:04 -0400 Received: from mout.web.de ([212.227.17.11]:54184 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752089AbdKDNTD (ORCPT ); Sat, 4 Nov 2017 09:19:03 -0400 Received: from [192.168.1.3] ([92.226.117.170]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Le4Tw-1dL4gL04uS-00ptQ3; Sat, 04 Nov 2017 14:19:01 +0100 Subject: [PATCH 4/4] target: Delete an error message for a failed memory allocation in two functions From: SF Markus Elfring To: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, "Nicholas A. Bellinger" Cc: LKML , kernel-janitors@vger.kernel.org References: <27e27d42-473d-e8db-fe9e-803fed646881@users.sourceforge.net> Message-ID: Date: Sat, 4 Nov 2017 14:18:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <27e27d42-473d-e8db-fe9e-803fed646881@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:z4VCYiVykLHBRsyPrc+xvvRuNrLnZKXnEDZsQDeyawgIS6L1R2R HJvQDyl+VRhqw0CqMvRIIeKkigdNb/Iukg6bRP9dN8XDZy7IBWIMUrlqWeok5WQXBxxLifa +JZIv0u4PbpnPypazxiXuRHDigwIrEEzOJG/QDzjypKe0j+PUrJs8tbi40nPRD4rlZtPl2i C1bd2NwlyoBnARIfzAHug== X-UI-Out-Filterresults: notjunk:1; V01:K0:MOdN3jdtIlw=:xFTceTGfaQUgXafXfvFNcb 0sgIpDH5OKwXDo6kZQMvK+tSuiyJQ+87JPDh7zFZLu3M2/sX2xlZTn+Kjpi6XpP9yli4gRn3l C8v3TpV5BoWi1GtS5yP/FNUGdDgF0ALvoT+2NGYFDh9I4/c1oMJR7ccEdEFGwOJ7i89xcuDGG dXQ9LESo3CZhcN/gS/e2L+egK9ium0dOSS5XmuXSMiugYE5iVf7vhjS9eHA6SVmY0qrwbLS6d WBzhhFy5FePbK6tHHk7WyDHLTOAD4qKvVJ6XsLTBZLFlnoFadp5FbaO+HMbLn2pDkVM52ZO/P bE5D3u67Z3LWxd2XPwRRYHlhGdabCIXFiNkF2fLCGO8EAwYjvazM66UqvL0yrCMIX02zaCAGs UNNugK5SsmFBC2qgN2h5Z11zEkfCdU3mgSvrfDAjoTJUpnzKqT1Mzlb0lQFOXH7Mlu0wrrk2K VW23ITrwGirAmROEv9CQJAC1MQyTlD+27d66vwBNYB5V/BrpFO4NARAiBJ2qN5GV45RB35dDf yKtfKbagD6LBC4yxxlZDoIiWmfraJ2wZJpsiO9Ne3TKv1IMGB7nmsI2XkhBGN9TPeM7m+JMdx Rt0MZvhT3BgRyGLo0mrNTYexyTGxZpFf4JKkkFCXPkDtDoBbczKQqL5CoccHv3e/vu2MDWss1 6+T+LGuq87FOZ051yTFn+0DPJnT3aKsTHaT0Rk6BN7iHdOBZ1U1/DZiAeSuXBjhkD584XejGw rSLwdcO7HNlMEwjUK5H4mgBSqCfd8k7xVzibzNkYwPrAjy//OiUeYJOV4pvz7Bzm+GCEVAXbS 8Ub+U59mtsGx8vFMc8ZPObtYKX7LKtJm/aiTQtp65JbhzW/dyU= 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 From: Markus Elfring Date: Sat, 4 Nov 2017 13:43:22 +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/target_core_xcopy.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 1519e399392b..c2b3d3158208 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -681,10 +681,9 @@ static int target_xcopy_read_source( bool remote_port = (xop->op_origin == XCOL_DEST_RECV_OP); xpt_cmd = kzalloc(sizeof(*xpt_cmd), GFP_KERNEL); - if (!xpt_cmd) { - pr_err("Unable to allocate xcopy_pt_cmd\n"); + if (!xpt_cmd) return -ENOMEM; - } + init_completion(&xpt_cmd->xpt_passthrough_sem); se_cmd = &xpt_cmd->se_cmd; @@ -743,10 +742,9 @@ static int target_xcopy_write_destination( bool remote_port = (xop->op_origin == XCOL_SOURCE_RECV_OP); xpt_cmd = kzalloc(sizeof(*xpt_cmd), GFP_KERNEL); - if (!xpt_cmd) { - pr_err("Unable to allocate xcopy_pt_cmd\n"); + if (!xpt_cmd) return -ENOMEM; - } + init_completion(&xpt_cmd->xpt_passthrough_sem); se_cmd = &xpt_cmd->se_cmd;