From e0c62bb9bdf8b110679979febca401cbc5f34311 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 12 Jul 2021 10:28:35 +0200 Subject: handover_test: fix ts_str may be uninitialized Fix for: handover_test.c: In function 'res_ind': handover_test.c:1094:30: error: 'ts_str' may be used uninitialized in this function [-Werror=maybe-uninitialized] char subslot_val = ts_str[lchan->nr]; Fixes: f76424 ("RES IND: add test_resource_indication.ho_vty") Change-Id: I398ba24b945bad96896eeb5ddbaff9c48bacf8ab --- tests/handover/handover_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c index 8d316ca8e..2c97f782a 100644 --- a/tests/handover/handover_test.c +++ b/tests/handover/handover_test.c @@ -1077,7 +1077,7 @@ DEFUN(res_ind, res_ind_cmd, level = 0xff; for (i = 0; i < ARRAY_SIZE(trx->ts); i++) { - const char *ts_str; + const char *ts_str = NULL; struct gsm_lchan *lchan; size_t given_subslots = 0; struct gsm_bts_trx_ts *ts = &trx->ts[i]; @@ -1090,7 +1090,7 @@ DEFUN(res_ind, res_ind_cmd, ts_for_n_lchans(lchan, ts, ts->max_lchans_possible) { int chan_nr; - if (lchan->nr < given_subslots) { + if (lchan->nr < given_subslots && ts_str) { char subslot_val = ts_str[lchan->nr]; switch (subslot_val) { case '-': -- cgit v1.2.3