From patchwork Tue Dec 12 12:21:38 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: 10106855 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 C4C4060327 for ; Tue, 12 Dec 2017 12:23:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD53E29B82 for ; Tue, 12 Dec 2017 12:23:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B209D29B95; Tue, 12 Dec 2017 12:23:13 +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 4F90D29B82 for ; Tue, 12 Dec 2017 12:23:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752048AbdLLMW5 (ORCPT ); Tue, 12 Dec 2017 07:22:57 -0500 Received: from mout.web.de ([212.227.15.4]:59761 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751434AbdLLMWz (ORCPT ); Tue, 12 Dec 2017 07:22:55 -0500 Received: from [192.168.1.3] ([77.181.137.123]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M5OaF-1fFc141ikJ-00zX6C; Tue, 12 Dec 2017 13:22:37 +0100 Subject: [PATCH 1/2] target: cxgbit: Delete an error message for a failed memory allocation in two functions From: SF Markus Elfring To: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, Bart Van Assche , "David S. Miller" , Ingo Molnar , Johannes Berg , "Nicholas A. Bellinger" , Varun Prakash Cc: LKML , kernel-janitors@vger.kernel.org References: <77d06f1c-a650-644f-7364-55bb52aeb6ac@users.sourceforge.net> Message-ID: Date: Tue, 12 Dec 2017 13:21:38 +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: <77d06f1c-a650-644f-7364-55bb52aeb6ac@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:+z+ka6TBOdeOgf7jKSsdHP0zsQs+i3oMpfcva8tXmeLUu8NPey7 sI0z73U/JIbm578pON8ZR9S2CrcBsUwJToLq5B27ieLTWn6M+5fcs+nMJJ6BOOkMUfulfDd /xZrFjYBGto/trRMA3coxERRPuOTfHPvuUk9s3bWgKyYovKAaG3YhTXhXr6wEuc7oRHNZoJ RLWVOtkbTq0lqFgsc4KDw== X-UI-Out-Filterresults: notjunk:1; V01:K0:CcgjGWlZTQc=:NYGgi0dcO5q3o6wBFlfalt L6/5kY2vj7pItnzCwOjhD6Dar+1ck2AF9TA02Qwp/UgvhcxFT8xL1esohwnAmxFqXxUGgNg74 2pJIAyBW+eXmBsCKIlsc9+PtPGtXaWE2nlrgFuMHBmSDXCTIbDrORBCQ5Zq7JADeoB+vYeLy4 oRP1cRXqOpaxRcHeIquhR/U2ndXy0waXWGbBqZ4GNr+6PdZ/XeAJAIMjC8lnwQUsNjrRPb+9+ cGoWzBerRpP/3F38HAN35hmst26pkDSbF8pgDnRlFLq1mZEIIz4T2dm7cqbkczraw15cvM7FH wvQv4bMr4E8o2BGedlpxpezGRC+WsjOtJFBrv4qlAhyxjardlCiLyDvWROY+dDd9wHqsJDqOo nAfgBExmRS/Oox6x51iix9LutkUqbALAG1gpLhRLlOPB+RovtS8cqWJLoHXq45lXHTXB/aE+o bDYBbziT2+F1RcrD4E7HpIGqH92+/UkTne+zOOEvcKwDCCVRX8VjUD+tJFLVPsTrtJFL3vm4d S/i829Om7yIxsRNW6ZCShj8UB6bU42UAgovvg2grnvUzRd5oGtMkkbhcnSGIzlm1UA06hS/Hc /8pChJnPNDHsC+H+VK4yAcvAvpXRBoe0ywBCw+jv0eiNhoml1xCVGjzfjQ+r3x92H97j/tG9o X34W453G3SrugJEsnabY9Vuy5hfIE4WxiLWT+q/S3nWNqtwK3AGi7tWszFoyhrDekxGlYtXFL /3xLJAS0i01xCVcHcT2bkPDLxnwWlINoueWSLnFzaizI1HEC+ZYewPyYd6KGn9K3VYqz265M7 8GtndCTv0RG6Lqev0GQSJU+F19IQFZu/9c6TwRHQAdCG580nA9Fkoe8pX76KGeAHTEa10b5 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: Tue, 12 Dec 2017 11:34:51 +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/iscsi/cxgbit/cxgbit_target.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/target/iscsi/cxgbit/cxgbit_target.c b/drivers/target/iscsi/cxgbit/cxgbit_target.c index 514986b57c2d..9163152b6d0b 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_target.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_target.c @@ -1126,8 +1126,6 @@ static int cxgbit_handle_nop_out(struct cxgbit_sock *csk, struct iscsi_cmd *cmd) if (payload_length && hdr->ttt == cpu_to_be32(0xFFFFFFFF)) { ping_data = kzalloc(payload_length + 1, GFP_KERNEL); if (!ping_data) { - pr_err("Unable to allocate memory for" - " NOPOUT ping data.\n"); ret = -1; goto out; } @@ -1188,11 +1186,9 @@ cxgbit_handle_text_cmd(struct cxgbit_sock *csk, struct iscsi_cmd *cmd) if (payload_length) { text_in = kzalloc(payload_length, GFP_KERNEL); - if (!text_in) { - pr_err("Unable to allocate text_in of payload_length: %u\n", - payload_length); + if (!text_in) return -ENOMEM; - } + skb_copy_bits(csk->skb, pdu_cb->doffset, text_in, payload_length);