Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751453AbeAAUql (ORCPT + 1 other); Mon, 1 Jan 2018 15:46:41 -0500 Received: from mout.web.de ([212.227.15.4]:63105 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751243AbeAAUqj (ORCPT ); Mon, 1 Jan 2018 15:46:39 -0500 To: linux-rdma@vger.kernel.org, netdev@vger.kernel.org, Tariq Toukan Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] ethernet: mlx4: Delete an error message for a failed memory allocation in five functions Message-ID: <30191db0-4d99-0349-b66a-c7354ef90d50@users.sourceforge.net> Date: Mon, 1 Jan 2018 21:46:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:cQH0py77viBJ1xG6GBSRz7A2sVOaLej8NjO9Hec1YD4QbjvIx1P pKG0dTmie3OijjJWRel3RboF09/0JF5MO92R7KyE1XLm3K58PIME9z/awzygVkqpZ2vCc05 oOv7sKHDLgxvvEnehc09tfRdb9cCWMdXcBtRwyDBCGg6cTRc03HZCURC/KCv9UBsqZxN2bi M+MoEOGbdvHFrdx2lZE2Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:pfyGhGNImdE=:PJd8DEiqIT7F7IUTyY49UC YHUduggwvmzX1OBvT5NKAPG3J9b6judW8Go5ppscZJFBzfA8XeNM+3GTywSJqCm1vW1wGYyv4 mk+wg4NU4z0NrncwkVCrSX55F5+/fJLHYJ/n5WXiY8/Cm8sI58ALRyLNb30liVBRcJelmwMSj q7WGwRa40V1KSieMYp1Jh9GOWod6McpsBcLPCA+05/tvFcxeaA8AVH1KR1QmuwVtc4HXA3wLM MHrox+D79HiZTs9ce2PZvd0U/SHq4t0hB3kzJWWzm886rkmwrR0+x9WGN6VPk0MiaqFzHYQV6 ZSwwBxnN45anFIUZiUchm+WIS/48aEROHXpWBV2YKFbdGpWO9ImlWJ+8LUckW5kuUoOf06fLV egXMrzPyTrD/N5Y6K8k7AYZbYMp7WwbWJqPZw+pM0PT/JVbxb/KlpGt2alhuVQXQlcnmdDQve RNN3yxlR6kxUithL0U2J/Bm61nkZKCDlPu4A8OvpAuKvt5UYb24beQzPE2LrmkMtl/q3N1OGE J0iOOkPbyRKgUdFvRCXcArkRVByukTC4G1KKau5dYW1wmzfv1p9mPZgTtdpJWk7f/DDf8J2f3 i53+TyKFOJMa4otcD4dLhfcYDH7NBnCZJv+T9fqZ/SkH3uceqh+0G2pGenUTVX2bfLEBn2+ik +t4fudaQ5xXrmI0oc4+VrreUmxWysNvrKS+/juM9EVRn2n19OYw0D1+S/k+zgZsSDth+Bxa6q 2S5GbMIEQxUpOnKO7SjcKi96ux2XmpjBajfjL7SUHUKefAzqtOFOTXRjcbAW/ozR5jgevO5Ka UBbJBDShykxl7pJPZZxaqVcFxYmqQRDQu40SPcMTx6RqQav+lo= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Markus Elfring Date: Mon, 1 Jan 2018 21:42:27 +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/net/ethernet/mellanox/mlx4/en_cq.c | 4 +--- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 4 +--- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 4 +--- drivers/net/ethernet/mellanox/mlx4/main.c | 4 +--- drivers/net/ethernet/mellanox/mlx4/reset.c | 1 - 5 files changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c index 1e487acb4667..cf5e0d002b3f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_cq.c @@ -55,10 +55,8 @@ int mlx4_en_create_cq(struct mlx4_en_priv *priv, cq = kzalloc_node(sizeof(*cq), GFP_KERNEL, node); if (!cq) { cq = kzalloc(sizeof(*cq), GFP_KERNEL); - if (!cq) { - en_err(priv, "Failed to allocate CQ structure\n"); + if (!cq) return -ENOMEM; - } } cq->size = entries; diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index 85e28efcda33..103abe1ad0cb 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c @@ -272,10 +272,8 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, ring = kzalloc_node(sizeof(*ring), GFP_KERNEL, node); if (!ring) { ring = kzalloc(sizeof(*ring), GFP_KERNEL); - if (!ring) { - en_err(priv, "Failed to allocate RX ring structure\n"); + if (!ring) return -ENOMEM; - } } ring->prod = 0; diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 6b6853773848..a21d6ffaa244 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c @@ -58,10 +58,8 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, ring = kzalloc_node(sizeof(*ring), GFP_KERNEL, node); if (!ring) { ring = kzalloc(sizeof(*ring), GFP_KERNEL); - if (!ring) { - en_err(priv, "Failed allocating TX ring\n"); + if (!ring) return -ENOMEM; - } } ring->size = size; diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 4d84cab77105..c793c5b0b0cf 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -3177,10 +3177,8 @@ static u64 mlx4_enable_sriov(struct mlx4_dev *dev, struct pci_dev *pdev, } dev->dev_vfs = kzalloc(total_vfs * sizeof(*dev->dev_vfs), GFP_KERNEL); - if (NULL == dev->dev_vfs) { - mlx4_err(dev, "Failed to allocate memory for VFs\n"); + if (!dev->dev_vfs) goto disable_sriov; - } if (!(dev->flags & MLX4_FLAG_SRIOV)) { if (total_vfs > fw_enabled_sriov_vfs) { diff --git a/drivers/net/ethernet/mellanox/mlx4/reset.c b/drivers/net/ethernet/mellanox/mlx4/reset.c index 0076d88587ca..74d77e56cc35 100644 --- a/drivers/net/ethernet/mellanox/mlx4/reset.c +++ b/drivers/net/ethernet/mellanox/mlx4/reset.c @@ -72,7 +72,6 @@ int mlx4_reset(struct mlx4_dev *dev) hca_header = kmalloc(256, GFP_KERNEL); if (!hca_header) { err = -ENOMEM; - mlx4_err(dev, "Couldn't allocate memory to save HCA PCI header, aborting\n"); goto out; } -- 2.15.1