net/ixgbe: fix coverity issue
Checks
Commit Message
This patch fixes (Logically dead code ) coverity issue.
Coverity issue: 353624
Fixes: ba7b12dd64e4 ("net/ixgbe: fix link up in FreeBSD")
Signed-off-by: Shougang Wang <shougangx.wang@intel.com>
---
drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
Comments
On 02/11, Shougang Wang wrote:
>This patch fixes (Logically dead code ) coverity issue.
>
>Coverity issue: 353624
>Fixes: ba7b12dd64e4 ("net/ixgbe: fix link up in FreeBSD")
>
>Signed-off-by: Shougang Wang <shougangx.wang@intel.com>
>---
> drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
>index 7ea1962f6..b19f47f50 100644
>--- a/drivers/net/ixgbe/ixgbe_ethdev.c
>+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
>@@ -4128,15 +4128,11 @@ static int
> ixgbe_wait_for_link_up(struct ixgbe_hw *hw)
> {
> #ifdef RTE_EXEC_ENV_FREEBSD
>- const int nb_iter = 25;
>-#else
>- const int nb_iter = 0;
>-#endif
> int err, i;
> bool link_up = false;
> uint32_t speed = 0;
>
>- for (i = 0; i < nb_iter; i++) {
>+ for (i = 0; i < 25; i++) {
Better to keep the constant nb_iter instead of using magic number.
> err = ixgbe_check_link(hw, &speed, &link_up, 0);
> if (err)
> return err;
>@@ -4144,7 +4140,12 @@ ixgbe_wait_for_link_up(struct ixgbe_hw *hw)
> return 0;
> msec_delay(200);
> }
>+
Unrelated change.
Thanks,
Xiaolong
> return 0;
>+#else
>+ RTE_SET_USED(hw);
>+ return 0;
>+#endif
> }
>
> /* return 0 means link status changed, -1 means not changed */
>--
>2.17.1
>
@@ -4128,15 +4128,11 @@ static int
ixgbe_wait_for_link_up(struct ixgbe_hw *hw)
{
#ifdef RTE_EXEC_ENV_FREEBSD
- const int nb_iter = 25;
-#else
- const int nb_iter = 0;
-#endif
int err, i;
bool link_up = false;
uint32_t speed = 0;
- for (i = 0; i < nb_iter; i++) {
+ for (i = 0; i < 25; i++) {
err = ixgbe_check_link(hw, &speed, &link_up, 0);
if (err)
return err;
@@ -4144,7 +4140,12 @@ ixgbe_wait_for_link_up(struct ixgbe_hw *hw)
return 0;
msec_delay(200);
}
+
return 0;
+#else
+ RTE_SET_USED(hw);
+ return 0;
+#endif
}
/* return 0 means link status changed, -1 means not changed */