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(-) -- 2.1.0
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. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/librte_pmd_enic/enic_clsf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_pmd_enic/enic_clsf.c b/lib/librte_pmd_enic/enic_clsf.c index 30a4def..577a382 100644 --- a/lib/librte_pmd_enic/enic_clsf.c +++ b/lib/librte_pmd_enic/enic_clsf.c @@ -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; -- 2.1.0
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. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/librte_pmd_enic/vnic/vnic_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.c b/lib/librte_pmd_enic/vnic/vnic_dev.c index 21d5521..b1cd63f 100644 --- a/lib/librte_pmd_enic/vnic/vnic_dev.c +++ b/lib/librte_pmd_enic/vnic/vnic_dev.c @@ -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; -- 2.1.0
> 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
--
Thomas
On 05/12/14 9:27 pm, "Bruce Richardson" <bruce.richardson@intel.com> wrote: >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 ! > > lib/librte_pmd_enic/enic_clsf.c | 2 +- > lib/librte_pmd_enic/vnic/vnic_dev.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > >-- >2.1.0 >