enic fixes for clang compilation
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
PATCH 1/2 enic: fix initialization error with clang
In reply to a message not in the archiveThis 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
@@ -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
PATCH 2/2 enic: fix error with uninitialized variable.
In reply to a message not in the archiveThe 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
@@ -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
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
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