From patchwork Sun Dec 10 19:10:17 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: 10103983 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 42532602D8 for ; Sun, 10 Dec 2017 19:11:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3023029266 for ; Sun, 10 Dec 2017 19:11:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24BCB29296; Sun, 10 Dec 2017 19:11:31 +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=unavailable 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 DC27B29266 for ; Sun, 10 Dec 2017 19:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752172AbdLJTLP (ORCPT ); Sun, 10 Dec 2017 14:11:15 -0500 Received: from mout.web.de ([212.227.15.14]:64077 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751991AbdLJTLN (ORCPT ); Sun, 10 Dec 2017 14:11:13 -0500 Received: from [192.168.1.3] ([78.48.148.47]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MEVQ1-1eHIaY1npZ-00FiUv; Sun, 10 Dec 2017 20:10:59 +0100 To: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, linux1394-devel@lists.sourceforge.net, Chris Boot , "Nicholas A. Bellinger" Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] sbp-target: Delete an error message for a failed memory allocation in three functions Message-ID: <06164454-67a9-d206-647c-b70f4a1c3812@users.sourceforge.net> Date: Sun, 10 Dec 2017 20:10:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:gVDO0i5FVLoys0RxJiFsdbKmpTIQbcak/m1S+hbj2TxBIIYg2Ri yOWRa8e7uzbfrTZmwc6F/F3XfJBwsQZ+9CLQgIub05reuLCgIb8o3ui6PqEUofWDL8ptAJY aZUiDUQkkYP0MoAL3D1GOJ5H38imcVT3uq9bc4jfCxiJYTx17PwwvvlBaIsjAf7oZRRvfod TDkpdLnQkrvM2WXTlOujQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:/lVZPXOYiMw=:QjjYFo/h2jVPKWlO/Tdh6H Ow4HIx7uKnP4MpFLu0MrMJM3fNLQearsnidCq+DvCPiHTM4M5p3gQrDZqYZQEKNXfUQ28LPth qifSR04lyLM1Gx5NKVGjM7HipgeyO9QeX6Svxet/Xkl0Gk8mBcUY4P/VKWzc2xzgESrPbfFhu h0sAFzN9o26mJR9hZWUF1eS8qxUZe8nen6PLpXR1Kb9l310HvrGXplhVq+Jpo274x7GFK3G5e qFiRAswoKRWJABz4xEgKwMZXzbE7q07wVwDWazKprS07ogBRgfPJxlxNNyCgxrdOd2Y5sXzYU PTkwhRtHXLP4jbkgGjx8qCq+tR629zXMJcph0aIvuPc0nX7qxErYCKJWwBCrzQz4suvlTjlLd rW234oA8jenTK6EzNLsdZdYckiFRWfHNtSD9ZnltYLzB27im3ZBWwbJxT7hHtG3WecsihkIKe CgN9Zbj+VO1DRNh96qU6eh8wsz3IPZWF3pN0gTbDz1BRIyTDgCfVXwDZYhP2EdZ5G9ltLZXKd i6JNMPNIIjV0OsPCAhXuCF378KRXEhf27a9hopJurC0iDOwY1cl6Dg04nhGlQJHFbW/IfvKSo MW2oTd0XLgplplWft1dBA56HIykApYanYrTy+1AMamfqo970v1clPeWIeqKOFJ/ZhNpF87l8x UjCFJV5F4T0irlbIjsOF4YeQaPltkvVyI1kL+veV1pHo4DHrCx4sqiurQMkGfcscLmghcOlF+ Gi0zX0g/ORMvgBmf/6P9FZ3E9YosjwYv1iC/RxSFaB1G+T86D1XG/W2Z3xLmGV+DPtjV7AFUA IjkzOEPNHQwzniJ/WcsJRIGcvndHW4VAaYpMQGRVdBzl3SZfzeRl8PWQNo68lNouPKLq7Gr 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 19:54:11 +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 Acked-by: Chris Boot --- drivers/target/sbp/sbp_target.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index e5c3e5f827d0..fb1003921d85 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -201,10 +201,9 @@ static struct sbp_session *sbp_session_create( snprintf(guid_str, sizeof(guid_str), "%016llx", guid); sess = kmalloc(sizeof(*sess), GFP_KERNEL); - if (!sess) { - pr_err("failed to allocate session descriptor\n"); + if (!sess) return ERR_PTR(-ENOMEM); - } + spin_lock_init(&sess->lock); INIT_LIST_HEAD(&sess->login_list); INIT_DELAYED_WORK(&sess->maint_work, session_maintenance_work); @@ -2029,10 +2028,8 @@ static struct se_portal_group *sbp_make_tpg( } tpg = kzalloc(sizeof(*tpg), GFP_KERNEL); - if (!tpg) { - pr_err("Unable to allocate struct sbp_tpg\n"); + if (!tpg) return ERR_PTR(-ENOMEM); - } tpg->tport = tport; tpg->tport_tpgt = tpgt; @@ -2088,10 +2085,8 @@ static struct se_wwn *sbp_make_tport( return ERR_PTR(-EINVAL); tport = kzalloc(sizeof(*tport), GFP_KERNEL); - if (!tport) { - pr_err("Unable to allocate struct sbp_tport\n"); + if (!tport) return ERR_PTR(-ENOMEM); - } tport->guid = guid; sbp_format_wwn(tport->tport_name, SBP_NAMELEN, guid);