From: Mohammad Shuab Siddique <[email protected]>

Use a < 0 guard instead of == -1 when checking the return values of
ulp_sc_find_free_cpu() and ulp_sc_get_first_dpdk_cpu() before passing
target_cpu to CPU_SET(). Both helpers only ever return -1 today, so
this does not change behavior for the current implementation, but it
makes the non-negative invariant on target_cpu explicit at the
CPU_SET() call site instead of relying on -1 being the only possible
failure value.

Signed-off-by: Mohammad Shuab Siddique <[email protected]>
Signed-off-by: Manish Kurup <[email protected]>
---
 drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c 
b/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c
index 221b57cbf7..92defadc20 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c
@@ -422,9 +422,9 @@ ulp_sc_mgr_thread_start(struct bnxt_ulp_context *ctxt)
                /* Try to find a free CPU not used by DPDK lcores */
                target_cpu = ulp_sc_find_free_cpu();
                /* If no free CPU found, use first CPU from first DPDK lcore */
-               if (target_cpu == -1) {
+               if (target_cpu < 0) {
                        target_cpu = ulp_sc_get_first_dpdk_cpu();
-                       if (target_cpu == -1)
+                       if (target_cpu < 0)
                                return -ENOENT;
                }
 
-- 
2.31.1

Reply via email to