diff mbox

[dpdk-dev] enic: fix of compile error

Message ID 1418115370-31965-1-git-send-email-helin.zhang@intel.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Helin Zhang Dec. 9, 2014, 8:56 a.m. UTC
Compile warnings/errors was found on gcc 4.7.2 as follows. Variables
was reported of being used but uninitialized. Assigning an initial
value to it is needed.

lib/librte_pmd_enic/vnic/vnic_dev.c: In function vnic_dev_get_mac_addr:
lib/librte_pmd_enic/vnic/vnic_dev.c:393:16: error: a1 may be used uninitialized in this function [-Werror=uninitialized]
lib/librte_pmd_enic/vnic/vnic_dev.c:629:10: note: a1 was declared here
lib/librte_pmd_enic/vnic/vnic_dev.c: In function vnic_dev_set_mac_addr:
lib/librte_pmd_enic/vnic/vnic_dev.c:393:16: error: a1 may be used uninitialized in this function [-Werror=uninitialized]
lib/librte_pmd_enic/vnic/vnic_dev.c:980:10: note: a1 was declared here

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
 lib/librte_pmd_enic/vnic/vnic_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thomas Monjalon Dec. 11, 2014, 1:03 a.m. UTC | #1
> Compile warnings/errors was found on gcc 4.7.2 as follows. Variables
> was reported of being used but uninitialized. Assigning an initial
> value to it is needed.
> 
> lib/librte_pmd_enic/vnic/vnic_dev.c: In function vnic_dev_get_mac_addr:
> lib/librte_pmd_enic/vnic/vnic_dev.c:393:16: error: a1 may be used uninitialized in this function [-Werror=uninitialized]
> lib/librte_pmd_enic/vnic/vnic_dev.c:629:10: note: a1 was declared here
> lib/librte_pmd_enic/vnic/vnic_dev.c: In function vnic_dev_set_mac_addr:
> lib/librte_pmd_enic/vnic/vnic_dev.c:393:16: error: a1 may be used uninitialized in this function [-Werror=uninitialized]
> lib/librte_pmd_enic/vnic/vnic_dev.c:980:10: note: a1 was declared here
> 
> Signed-off-by: Helin Zhang <helin.zhang@intel.com>

Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Applied

Thanks
diff mbox

Patch

diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.c b/lib/librte_pmd_enic/vnic/vnic_dev.c
index b1cd63f..6407994 100644
--- a/lib/librte_pmd_enic/vnic/vnic_dev.c
+++ b/lib/librte_pmd_enic/vnic/vnic_dev.c
@@ -626,7 +626,7 @@  int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done)
 
 int vnic_dev_get_mac_addr(struct vnic_dev *vdev, u8 *mac_addr)
 {
-	u64 a0, a1;
+	u64 a0, a1 = 0;
 	int wait = 1000;
 	int err, i;
 
@@ -977,7 +977,7 @@  struct rte_pci_device *vnic_dev_get_pdev(struct vnic_dev *vdev)
 
 int vnic_dev_set_mac_addr(struct vnic_dev *vdev, u8 *mac_addr)
 {
-	u64 a0, a1;
+	u64 a0, a1 = 0;
 	int wait = 1000;
 	int i;