net/nfp: fix misuse of function return values
Checks
Commit Message
From: Zerun Fu <zerun.fu@corigine.com>
The 'nfp_ct_offload_add()' return 0 means the result is right
while return negative number means the wrong result.
The caller assigns the 'int' variable to the 'bool' variable.
So the negative number will be transform to 'true'. This will
cause an error because 'true' will be regard as no problem.
Fixes: b4ae16eae01c ("net/nfp: support to add and delete flows to firmware")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Zerun Fu <zerun.fu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/flower/nfp_conntrack.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
@@ -1440,6 +1440,7 @@ nfp_ct_do_flow_merge(struct nfp_ct_zone_entry *ze,
struct nfp_ct_flow_entry *pre_ct_entry,
struct nfp_ct_flow_entry *post_ct_entry)
{
+ int err;
bool ret;
uint64_t new_cookie[2];
uint8_t cnt_same_item = 0;
@@ -1508,9 +1509,10 @@ nfp_ct_do_flow_merge(struct nfp_ct_zone_entry *ze,
}
/* Send to firmware */
- ret = nfp_ct_offload_add(pre_ct_entry->dev, merge_entry);
- if (ret != 0) {
+ err = nfp_ct_offload_add(pre_ct_entry->dev, merge_entry);
+ if (err != 0) {
PMD_DRV_LOG(ERR, "Send the merged flow to firmware failed.");
+ ret = false;
goto merge_table_del;
}