Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751169AbeABV2d (ORCPT + 1 other); Tue, 2 Jan 2018 16:28:33 -0500 Received: from mout.web.de ([212.227.15.14]:64390 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbeABV2b (ORCPT ); Tue, 2 Jan 2018 16:28:31 -0500 To: netdev@vger.kernel.org, Murali Karicheri , Wingman Kwok Cc: LKML , kernel-janitors@vger.kernel.org, "David S. Miller" , Grant Likely , Ian Campbell , Kumar Gala , Mark Rutland , Pawel Moll , Rob Herring , Santosh Shilimkar From: SF Markus Elfring Subject: [PATCH] netcp_ethss: Delete error messages for a failed memory allocation in three functions Message-ID: Date: Tue, 2 Jan 2018 22:28:08 +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: 7bit X-Provags-ID: V03:K0:gPvel2BXnNZumPwoPAitpv9u5gr6xHVkmPjUtwtcmldnEXxMhbM tBl+P5dIJCgaKmBya+vr2IE4+rUQ/gk8EIP3wL8A0pRbezNUTFbKac2vq7lQwuAInNCEBZo 8FIAaLFxjpQaoiXAKeafWw0Zxnz39opIGwDH4OTZx6B8c4BmxPwT/awWd82kkJyO79FtJZY a+Q0vBQaehH8DzbUoN2hA== X-UI-Out-Filterresults: notjunk:1;V01:K0:IKzMb2AbbZo=:iy3xPw1S/9jEFoQz5oO9jE Fhsfj3fpsxJbyxBUdW65tXbhQzIAcJy7VHjvVxvsOBiq/DJVQ5caU9ubuI7F+cTCIAAFMrJDD /bGT2VkDPSdk8/hURClMISBmN4kk1KS5fUGhgeqDqSblGOQbSJPenU9A8Rbs6GtvVrApF0j2v WMelc1H1MscbpVf0rs/u3heFinUoJgbI09sIvmntuto9EbH5WbXYKlQwgiNdU2GKSg+jdyIex swVOk2WRcyk5FnMAZqzpkeoHrTLdxqOvkENFGtglD8LDKqyD9FPDvIMCQsPpdJC1Vr2nJsKGK bxTauWJn10Emn9novijNt7stfZ9Tf7rWd2rZuG1PfagZhhCODHkfZnHi3C4fiCTjLK9LLFye4 NTIMR3GSK85ABnlQTPTj59URxHupojgkh5PxuziXCgawz4Erfzv7bRB+TxRiNcBFg3VUHliod PxQ6AYF0HV8e7o4Z/CCgN00QqKjqwkT56KpfpMY9X96gItIflpGPG8BTKizu2W8VGtrszL50+ 42+3jM3hTwPqYGuevUoXrIAi8VtZPcpoyk9rGMaSqF26NGHDPKY2o9sLOGWZ94z5XsUv8Cndc cFi53PTofIPcycbcbCmem1kw8WJLUnX8gwoB4bTTU9zsuGmKfYyS86djr3Q6DXglbRBYP4W1a A322gb1KYLCITe9FfYNhSXEDf99MCSplTN+5hZatRyvYQKffuiF/BTN/unMrKb8+w/OK3Hb5R 3ulmwiqlSsd9JxO5upoQfrdTZnJpWjA4xVdnvh6XkPjVAgB9yPADgkivMC9Is9+ez7MdI5l5G HyTzRdFRJnNuKHKZnJF8Kw+eNYSw9ZhLUttdl07+5ei+U7kENQ= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Markus Elfring Date: Tue, 2 Jan 2018 22:08:50 +0100 Omit extra messages 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/ti/netcp_ethss.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index 4ad821655e51..91ce6f8f8098 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -3176,20 +3176,15 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev, gbe_dev->hw_stats = devm_kzalloc(gbe_dev->dev, gbe_dev->num_et_stats * sizeof(u64), GFP_KERNEL); - if (!gbe_dev->hw_stats) { - dev_err(gbe_dev->dev, "hw_stats memory allocation failed\n"); + if (!gbe_dev->hw_stats) return -ENOMEM; - } gbe_dev->hw_stats_prev = devm_kzalloc(gbe_dev->dev, gbe_dev->num_et_stats * sizeof(u32), GFP_KERNEL); - if (!gbe_dev->hw_stats_prev) { - dev_err(gbe_dev->dev, - "hw_stats_prev memory allocation failed\n"); + if (!gbe_dev->hw_stats_prev) return -ENOMEM; - } gbe_dev->ss_version = XGBE_SS_VERSION_10; gbe_dev->sgmii_port_regs = gbe_dev->ss_regs + @@ -3296,20 +3291,15 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, gbe_dev->hw_stats = devm_kzalloc(gbe_dev->dev, gbe_dev->num_et_stats * sizeof(u64), GFP_KERNEL); - if (!gbe_dev->hw_stats) { - dev_err(gbe_dev->dev, "hw_stats memory allocation failed\n"); + if (!gbe_dev->hw_stats) return -ENOMEM; - } gbe_dev->hw_stats_prev = devm_kzalloc(gbe_dev->dev, gbe_dev->num_et_stats * sizeof(u32), GFP_KERNEL); - if (!gbe_dev->hw_stats_prev) { - dev_err(gbe_dev->dev, - "hw_stats_prev memory allocation failed\n"); + if (!gbe_dev->hw_stats_prev) return -ENOMEM; - } gbe_dev->sgmii_port_regs = gbe_dev->ss_regs + GBE13_SGMII_MODULE_OFFSET; gbe_dev->host_port_regs = gbe_dev->switch_regs + GBE13_HOST_PORT_OFFSET; @@ -3368,20 +3358,15 @@ static int set_gbenu_ethss_priv(struct gbe_priv *gbe_dev, gbe_dev->hw_stats = devm_kzalloc(gbe_dev->dev, gbe_dev->num_et_stats * sizeof(u64), GFP_KERNEL); - if (!gbe_dev->hw_stats) { - dev_err(gbe_dev->dev, "hw_stats memory allocation failed\n"); + if (!gbe_dev->hw_stats) return -ENOMEM; - } gbe_dev->hw_stats_prev = devm_kzalloc(gbe_dev->dev, gbe_dev->num_et_stats * sizeof(u32), GFP_KERNEL); - if (!gbe_dev->hw_stats_prev) { - dev_err(gbe_dev->dev, - "hw_stats_prev memory allocation failed\n"); + if (!gbe_dev->hw_stats_prev) return -ENOMEM; - } ret = of_address_to_resource(node, GBENU_SM_REG_INDEX, &res); if (ret) { -- 2.15.1