net/octeontx: fix uninitialized speed variable
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 5 Apr 2018 15:12:28 +0000 (08:12 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 13 Apr 2018 22:40:21 +0000 (00:40 +0200)
This is fix for Coverity Defect 268319 about uninitialized speed
in an error case. Also drop unnecessary assignment.

Coverity issue: 268319
Fixes: 4fac7c0a147e ("net/octeontx: add link update")
CC: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
drivers/net/octeontx/octeontx_ethdev.c

index 15da4ea..1406e4e 100644 (file)
@@ -524,7 +524,6 @@ octeontx_dev_link_update(struct rte_eth_dev *dev,
        struct rte_eth_link link;
        int res;
 
-       res = 0;
        PMD_INIT_FUNC_TRACE();
 
        res = octeontx_port_link_status(nic);
@@ -558,6 +557,7 @@ octeontx_dev_link_update(struct rte_eth_dev *dev,
        case OCTEONTX_LINK_SPEED_RESERVE1:
        case OCTEONTX_LINK_SPEED_RESERVE2:
        default:
+               link.link_speed = ETH_SPEED_NUM_NONE;
                octeontx_log_err("incorrect link speed %d", nic->speed);
                break;
        }