From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/2] kni: fix coccinelle warnings
Date: Thu, 16 Jul 2015 16:47:24 -0700 [thread overview]
Message-ID: <1437090444-24953-3-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1437090444-24953-1-git-send-email-stephen@networkplumber.org>
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 <stephen@networkplumber.org>
---
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
next prev parent reply other threads:[~2015-07-16 23:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-16 23:47 [dpdk-dev] [PATCH 0/2] static matcher cleanups Stephen Hemminger
2015-07-16 23:47 ` [dpdk-dev] [PATCH 1/2] rte_ethdev: fix crash if malloc fails in rte_eth_dev_callback_register Stephen Hemminger
2015-07-17 8:16 ` Bruce Richardson
2015-07-22 13:54 ` Thomas Monjalon
2015-07-16 23:47 ` Stephen Hemminger [this message]
2015-07-22 14:25 ` [dpdk-dev] [PATCH 0/2] static matcher cleanups Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1437090444-24953-3-git-send-email-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).