usteer: Fix better candidate not being set in policy
authorWojciech Dubowik <Wojciech.Dubowik@westermo.com>
Tue, 17 May 2022 12:12:41 +0000 (14:12 +0200)
committerDavid Bauer <mail@david-bauer.net>
Tue, 17 May 2022 14:21:14 +0000 (16:21 +0200)
The candidate is never set in this loop. Fix it by setting it
to the first valid entry.

Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@westermo.com>
policy.c

index a7efc06342794a59eeb71aa78ef64c59871542fb..8155e245f4398fe8ee7d77bf95a3603283ee4c2e 100644 (file)
--- a/policy.c
+++ b/policy.c
@@ -143,7 +143,7 @@ find_better_candidate(struct sta_info *si_ref, struct uevent *ev, uint32_t requi
                        ev->select_reasons = reasons;
                }
 
-               if (candidate && si->signal > candidate->signal)
+               if (!candidate || si->signal > candidate->signal)
                        candidate = si;
        }