From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by dpdk.org (Postfix) with ESMTP id 7DD2C376D for ; Fri, 17 Jul 2015 01:47:22 +0200 (CEST) Received: by pactm7 with SMTP id tm7so50816809pac.2 for ; Thu, 16 Jul 2015 16:47:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZFx46SHTSyMOpav0GIXRdETZRnbsE7I02KXWUEpN8ec=; b=Qe53ox0/+LIHqAPMmFBv7Qzz0eJRrLuBfoFwMisnwU0fMy7cynr3wgGYpvqjDL4twT 1SJm6KJXyzNa2B5H5aKvgbc4w/Gr6MdY166xQiaSnELTcDdjtIzxqQXCwU9ubDn01jYQ DzYvYQduqQNyOux8cAGMEccb1Ik3LklVnIAT+nZsw5AkLxPmQdvzxh1Znnb/qz9dDjYp 1gfv9aOQUP7m3jLtEvQUEWTn/9n55DCYjUA6hKpg3IuynxKz9stJAD3h59s5KMw153B1 1DeHes0LV0lLAdGJcALPbDopWI7fefpcwHfVk89ryxbaQD4HhLkdDRdr82ANCQWE6/jU x5oQ== X-Gm-Message-State: ALoCoQnlqAOj5r7lgnFf6FUHRiBdYLBfRHstC7YrD0y5MwbZPrqlhbS6EQPcfFALFJ8/WqcJMq8n X-Received: by 10.70.55.165 with SMTP id t5mr23267825pdp.102.1437090441950; Thu, 16 Jul 2015 16:47:21 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id sd7sm9059134pbb.93.2015.07.16.16.47.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Jul 2015 16:47:21 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Date: Thu, 16 Jul 2015 16:47:24 -0700 Message-Id: <1437090444-24953-3-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1437090444-24953-1-git-send-email-stephen@networkplumber.org> References: <1437090444-24953-1-git-send-email-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 2/2] kni: fix coccinelle warnings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2015 23:47:23 -0000 This fixes cases in KNI where kernel allocation function return value is needlessly casted. lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c:3181:25-28: WARNING: casting value returned by memory allocation function to (u32 *) is useless. lib/librte_eal/linuxapp/kni/kni_vhost.c:690:9-28: WARNING: casting value returned by memory allocation function to (struct rte_kni_fifo *) is useless. lib/librte_eal/linuxapp/kni/kni_vhost.c:684:13-27: WARNING: casting value returned by memory allocation function to (struct sk_buff *) is useless Signed-off-by: Stephen Hemminger --- lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 4 ++-- lib/librte_eal/linuxapp/kni/kni_vhost.c | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c index 47198bb..eed8df6 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c @@ -3178,8 +3178,8 @@ static int igb_sw_init(struct igb_adapter *adapter) GFP_ATOMIC); /* Setup and initialize a copy of the hw vlan table array */ - adapter->shadow_vfta = (u32 *)kzalloc(sizeof(u32) * E1000_VFTA_ENTRIES, - GFP_ATOMIC); + adapter->shadow_vfta = kzalloc(sizeof(u32) * E1000_VFTA_ENTRIES, + GFP_ATOMIC); #ifdef NO_KNI /* These calls may decrease the number of queues */ if (hw->mac.type < e1000_i210) { diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c index 013a677..d0c12a6 100644 --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c @@ -681,14 +681,12 @@ kni_vhost_backend_init(struct kni_dev *kni) } /* cache init */ - q->cache = (struct sk_buff*) - kzalloc(RTE_KNI_VHOST_MAX_CACHE_SIZE * sizeof(struct sk_buff), - GFP_KERNEL); + q->cache = kzalloc(RTE_KNI_VHOST_MAX_CACHE_SIZE * sizeof(struct sk_buff), + GFP_KERNEL); if (!q->cache) goto free_fd; - fifo = (struct rte_kni_fifo*) - kzalloc(RTE_KNI_VHOST_MAX_CACHE_SIZE * sizeof(void *) + fifo = kzalloc(RTE_KNI_VHOST_MAX_CACHE_SIZE * sizeof(void *) + sizeof(struct rte_kni_fifo), GFP_KERNEL); if (!fifo) goto free_cache; -- 2.1.4