aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-07-15 13:51:36 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-07-15 13:51:38 +0200
commitace4e500edb702d628bb9103190aad6803b610e8 (patch)
tree9f9bfc31ea7c8f292b5bf466fef9f9a079c8b4cf /src
parentdda5cf4bb7622eba600042464910c02fab1aaa49 (diff)
Make gcc 11.1.0 false positivies happy
Make gcc 11.1.0 false positivies happy After my system's gcc was upgraded, I get false positivies in a couple places. Let's initialize those to make gcc happy. """ //git/osmo-bts/src/common/vty.c: In function ‘lchan_summary’: //git/osmo-bts/src/common/vty.c:1881:23: error: ‘ts’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1881 | lchan = &ts->lchan[lchan_nr]; | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~ //git/osmo-bts/src/common/vty.c:1869:20: error: ‘trx’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1869 | ts = &trx->ts[ts_nr]; | ~~~^~~~~~~~~~~~~~~~~ //git/osmo-bts/src/common/vty.c:1852:34: error: ‘bts’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1852 | if (trx_nr >= bts->num_trx) { """ Change-Id: I93477142a5a4b3f3829b7398d6e564c127263596
Diffstat (limited to 'src')
-rw-r--r--src/common/vty.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/vty.c b/src/common/vty.c
index 3065a90a..a7d1e845 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1828,9 +1828,9 @@ static int lchan_summary(struct vty *vty, int argc, const char **argv,
void (*dump_cb)(struct vty *, const struct gsm_lchan *))
{
const struct gsm_network *net = gsmnet_from_vty(vty);
- const struct gsm_bts *bts;
- const struct gsm_bts_trx *trx;
- const struct gsm_bts_trx_ts *ts;
+ const struct gsm_bts *bts = NULL; /* initialize to avoid uninitialized false warnings on some gcc versions (11.1.0) */
+ const struct gsm_bts_trx *trx = NULL; /* initialize to avoid uninitialized false warnings on some gcc versions (11.1.0) */
+ const struct gsm_bts_trx_ts *ts = NULL; /* initialize to avoid uninitialized false warnings on some gcc versions (11.1.0) */
const struct gsm_lchan *lchan;
int bts_nr, trx_nr, ts_nr, lchan_nr;