Skip to contentSkip to conversation

enic fixes for clang compilation

PATCH In review Bruce Richardson 3 participants 5 messages Dec 5, 2014 – Dec 7, 2014 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover enic fixes for clang compilation

Compiling latest DPDK with clang 3.3 on FreeBSD 10 shows up a number of compilation errors in the enic driver. These two small patches fix those errors.

Bruce Richardson (2):
enic: fix initialization error with clang
enic: fix error with uninitialized variable.

 lib/librte_pmd_enic/enic_clsf.c     | 2 +-
 lib/librte_pmd_enic/vnic/vnic_dev.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.1.0
#2 lore raw

PATCH 1/2 enic: fix initialization error with clang

In reply to a message not in the archive

This patch fixes the following compiler error raised by clang 3.3 on FreeBSD 10:

CC enic_clsf.o
/usr/home/bruce/dpdk.org/lib/librte_pmd_enic/enic_clsf.c:99:25: fatal error: missing field 'u' initializer [-Wmissing-field-initializers]

        struct filter fltr = {0};

It fixes it by changing the initializer to set a named field to zero, thereby automatically setting the rest of the unnamed fields also to zero.

---
 lib/librte_pmd_enic/enic_clsf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_pmd_enic/enic_clsf.c +1 -1
index 30a4def..577a382 100644
@@ -96,7 +96,7 @@ int enic_fdir_add_fltr(struct enic *enic, struct rte_fdir_filter *params,
 	u16 queue, u8 drop)
 {
 	struct enic_fdir_node *key;
-	struct filter fltr = {0};
+	struct filter fltr = {.type = 0};
 	int32_t pos;
 	u8 do_free = 0;
 	u16 old_fltr_id = 0;
Signature · 1 line
2.1.0
#3 lore raw

PATCH 2/2 enic: fix error with uninitialized variable.

In reply to a message not in the archive

The variable notify_pa is only initialized inside one branch of an if statement, triggering a compiler error with clang 3.3 on FreeBSD.

CC vnic/vnic_dev.o
/usr/home/bruce/dpdk.org/lib/librte_pmd_enic/vnic/vnic_dev.c:777:6: fatal error: variable 'notify_pa'
is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (!vnic_dev_in_reset(vdev)) {

Fix this issue by adding "= 0" to the variable definition.

---
 lib/librte_pmd_enic/vnic/vnic_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_pmd_enic/vnic/vnic_dev.c +1 -1
index 21d5521..b1cd63f 100644
@@ -764,7 +764,7 @@ int vnic_dev_notify_setcmd(struct vnic_dev *vdev,
 int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr)
 {
 	void *notify_addr = NULL;
-	dma_addr_t notify_pa;
+	dma_addr_t notify_pa = 0;
 	char name[NAME_MAX];
 	static u32 instance;
 
Signature · 1 line
2.1.0
#4 lore raw
In reply to a message not in the archive
Quoted 6 lines

Compiling latest DPDK with clang 3.3 on FreeBSD 10 shows up a number of compilation errors in the enic driver. These two small patches fix those errors.

Bruce Richardson (2):
enic: fix initialization error with clang
enic: fix error with uninitialized variable.

Acked and applied

Thanks

Signature · 1 line
Thomas
#5 lore raw
In reply to a message not in the archive
Quoted 7 lines · Bruce Richardson

Compiling latest DPDK with clang 3.3 on FreeBSD 10 shows up a number of compilation
errors in the enic driver. These two small patches fix those errors.

Bruce Richardson (2):
enic: fix initialization error with clang
enic: fix error with uninitialized variable.

Sorry for the delay. Was away for a couple of days.

Looks good.
Thanks !

Quoted 8 lines

lib/librte_pmd_enic/enic_clsf.c | 2 +-
lib/librte_pmd_enic/vnic/vnic_dev.c | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.1.0