aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-04-18 17:16:56 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-04-18 17:31:40 +0200
commit80352e03ca1c1fb7153f97477e41f8bc2875db2b (patch)
tree59c972cf69f486392eeef3e45f75d62fcf46e0ea /openbsc
parentd447e99587f0ee949066bc691200b6a7c3db5bdf (diff)
ho: Initialize nmp_worst as it was not initialized
The compiler can't know that on the first iteration we will assign nmp_worst as we have used a high average value.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/libbsc/handover_decision.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/openbsc/src/libbsc/handover_decision.c b/openbsc/src/libbsc/handover_decision.c
index 31fd6107a..d6fd4f471 100644
--- a/openbsc/src/libbsc/handover_decision.c
+++ b/openbsc/src/libbsc/handover_decision.c
@@ -93,7 +93,7 @@ static int neigh_meas_avg(struct neigh_meas_proc *nmp, int window)
static struct neigh_meas_proc *find_evict_neigh(struct gsm_lchan *lchan)
{
int j, worst = 999999;
- struct neigh_meas_proc *nmp_worst;
+ struct neigh_meas_proc *nmp_worst = NULL;
/* first try to find an empty/unused slot */
for (j = 0; j < ARRAY_SIZE(lchan->neigh_meas); j++) {
@@ -106,7 +106,7 @@ static struct neigh_meas_proc *find_evict_neigh(struct gsm_lchan *lchan)
for (j = 0; j < ARRAY_SIZE(lchan->neigh_meas); j++) {
struct neigh_meas_proc *nmp = &lchan->neigh_meas[j];
int avg = neigh_meas_avg(nmp, MAX_WIN_NEIGH_AVG);
- if (avg < worst) {
+ if (!nmp_worst || avg < worst) {
worst = avg;
nmp_worst = nmp;
}