[PATCH 3/8] firmware: initialize variables

Alexander Huemer alexander.huemer at xx.vu
Wed Nov 23 22:59:39 UTC 2011


this eliminates the occurrance of gcc warnings
warning: ‘?’ may be used uninitialized in this function
warning: ‘?’ is used uninitialized in this function
---
 src/target/firmware/apps/loader/main.c     |    2 +-
 src/target/firmware/apps/loader_mtk/main.c |    2 +-
 src/target/firmware/layer1/l23_api.c       |    2 +-
 src/target/firmware/layer1/mframe_sched.c  |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/target/firmware/apps/loader/main.c b/src/target/firmware/apps/loader/main.c
index 18f0b36..de2193a 100644
--- a/src/target/firmware/apps/loader/main.c
+++ b/src/target/firmware/apps/loader/main.c
@@ -204,7 +204,7 @@ static void cmd_handler(uint8_t dlci, struct msgb *msg)
 
 	uint8_t command = msgb_get_u8(msg);
 
-	int res;
+	int res = 0;
 
 	flash_lock_t lock;
 
diff --git a/src/target/firmware/apps/loader_mtk/main.c b/src/target/firmware/apps/loader_mtk/main.c
index 9bfaa7e..0bc4ab8 100644
--- a/src/target/firmware/apps/loader_mtk/main.c
+++ b/src/target/firmware/apps/loader_mtk/main.c
@@ -145,7 +145,7 @@ static void cmd_handler(uint8_t dlci, struct msgb *msg)
 
 	uint8_t command = msgb_get_u8(msg);
 
-	int res;
+	int res = 0;
 
 	flash_lock_t lock;
 
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c
index fd4ad09..bd990bb 100644
--- a/src/target/firmware/layer1/l23_api.c
+++ b/src/target/firmware/layer1/l23_api.c
@@ -69,7 +69,7 @@ static uint32_t chan_nr2mf_task_mask(uint8_t chan_nr, uint8_t neigh_mode)
 	uint8_t lch_idx;
 	enum mframe_task master_task = 0;
 	uint32_t neigh_task = 0;
-	enum mf_type multiframe;
+	enum mf_type multiframe = MFNONE;
 
 	if (cbits == 0x01) {
 		lch_idx = 0;
diff --git a/src/target/firmware/layer1/mframe_sched.c b/src/target/firmware/layer1/mframe_sched.c
index 6281c3d..5227d41 100644
--- a/src/target/firmware/layer1/mframe_sched.c
+++ b/src/target/firmware/layer1/mframe_sched.c
@@ -332,7 +332,7 @@ static const struct mframe_sched_item *sched_set_for_task[32] = {
 /* encodes a channel number according to 08.58 Chapter 9.3.1 */
 uint8_t mframe_task2chan_nr(enum mframe_task mft, uint8_t ts)
 {
-	uint8_t cbits;
+	uint8_t cbits = 0;
 
 	switch (mft) {
 	case MF_TASK_BCCH_NORM:
-- 
1.7.8.rc1





More information about the baseband-devel mailing list