[dpdk-dev,2/2] enic: fix error with uninitialized variable.

Message ID 1417795032-23524-3-git-send-email-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Bruce Richardson Dec. 5, 2014, 3:57 p.m. UTC
  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(-)
  

Patch

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;