[PATCH] cleanup some compile warnings

Max max.suraev at fairwaves.ru
Mon Dec 16 15:02:46 UTC 2013


---
 src/target/firmware/apps/loader/main.c  | 15 +++++++--------
 src/target/firmware/layer1/l23_api.c    |  1 -
 src/target/firmware/layer1/prim_fbsb.c  | 19 ++++++++-----------
 src/target/firmware/layer1/prim_freq.c  |  4 ++--
 src/target/firmware/layer1/prim_rach.c  |  1 -
 src/target/firmware/layer1/prim_tx_nb.c |  1 -
 6 files changed, 17 insertions(+), 24 deletions(-)

diff --git a/src/target/firmware/apps/loader/main.c b/src/target/firmware/apps/loader/main.c
index 39b8998..9b7a1b5 100644
--- a/src/target/firmware/apps/loader/main.c
+++ b/src/target/firmware/apps/loader/main.c
@@ -115,7 +115,7 @@ static void loader_send_init(uint8_t dlci)
 	struct msgb *msg = sercomm_alloc_msgb(9);
 	msgb_put_u8(msg, LOADER_INIT);
 	msgb_put_u32(msg, 0);
-	msgb_put_u32(msg, &_start);
+	msgb_put_u32(msg, (uint32_t)&_start);
 	sercomm_sendmsg(dlci, msg);
 }
 
@@ -128,7 +128,7 @@ static const uint8_t phone_ack[] = { 0x1b, 0xf6, 0x02, 0x00, 0x41, 0x03, 0x42 };
 int main(void)
 {
 	/* Simulate a compal loader saying "ACK" */
-	int i = 0;
+	unsigned i = 0;
 	for (i = 0; i < sizeof(phone_ack); i++) {
 		putchar_asm(phone_ack[i]);
 	}
@@ -171,13 +171,12 @@ int main(void)
 	if (flash_init(&the_flash, 0)) {
 		puts("Failed to initialize flash!\n");
 	} else {
-		printf("Found flash of %d bytes at 0x%x with %d regions\n",
+		printf("Found flash of %zu bytes at 0x%p with %zu regions\n",
 		       the_flash.f_size, the_flash.f_base,
 		       the_flash.f_nregions);
 
-		int i;
 		for (i = 0; i < the_flash.f_nregions; i++) {
-			printf("  Region %d of %d pages with %d bytes each.\n",
+			printf("  Region %d of %zu pages with %zu bytes each.\n",
 			       i,
 			       the_flash.f_regions[i].fr_bnum,
 			       the_flash.f_regions[i].fr_bsize);
@@ -213,7 +212,7 @@ static void cmd_handler(uint8_t dlci, struct msgb *msg)
 
 	uint8_t command = msgb_pull_u8(msg);
 
-	int res;
+	int res = 0;
 
 	flash_lock_t lock;
 
@@ -317,11 +316,11 @@ static void cmd_handler(uint8_t dlci, struct msgb *msg)
 		msgb_put_u8(reply, 1);	// nchips
 
 		// chip 1
-		msgb_put_u32(reply, the_flash.f_base);
+		msgb_put_u32(reply, (uint32_t)the_flash.f_base);
 		msgb_put_u32(reply, the_flash.f_size);
 		msgb_put_u8(reply, the_flash.f_nregions);
 
-		int i;
+		unsigned i;
 		for (i = 0; i < the_flash.f_nregions; i++) {
 			msgb_put_u32(reply, the_flash.f_regions[i].fr_bnum);
 			msgb_put_u32(reply, the_flash.f_regions[i].fr_bsize);
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c
index ae39e63..0b2bc6c 100644
--- a/src/target/firmware/layer1/l23_api.c
+++ b/src/target/firmware/layer1/l23_api.c
@@ -316,7 +316,6 @@ static void l1ctl_rx_crypto_req(struct msgb *msg)
 static void l1ctl_rx_dm_rel_req(struct msgb *msg)
 {
 	struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
-	struct l1ctl_info_ul *ul = (struct l1ctl_info_ul *) l1h->data;
 
 	printd("L1CTL_DM_REL_REQ\n");
 	l1a_mftask_set(0);
diff --git a/src/target/firmware/layer1/prim_fbsb.c b/src/target/firmware/layer1/prim_fbsb.c
index 19b0e0d..9eb56c6 100644
--- a/src/target/firmware/layer1/prim_fbsb.c
+++ b/src/target/firmware/layer1/prim_fbsb.c
@@ -25,7 +25,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
-
+#include <inttypes.h>
 #include <defines.h>
 #include <debug.h>
 #include <memory.h>
@@ -88,14 +88,14 @@ static struct mon_state *last_fb = &fbs.mon;
 static void dump_mon_state(struct mon_state *fb)
 {
 #if 0
-	printf("(%u:%u): TOA=%5u, Power=%4ddBm, Angle=%5dHz, "
+	printf("(%"PRIu32":%u): TOA=%5u, Power=%4ddBm, Angle=%5dHz, "
 		"SNR=%04x(%d.%u) OFFSET=%u SYNCHRO=%u\n",
 		fb->fnr_report, fb->attempt, fb->toa,
 		agc_inp_dbm8_by_pm(fb->pm)/8, ANGLE_TO_FREQ(fb->angle),
 		fb->snr, l1s_snr_int(fb->snr), l1s_snr_fract(fb->snr),
 		tpu_get_offset(), tpu_get_synchro());
 #else
-	printf("(%u:%u): TOA=%5u, Power=%4ddBm, Angle=%5dHz\n",
+	printf("(%"PRIu32":%u): TOA=%5u, Power=%4ddBm, Angle=%5dHz\n",
 		fb->fnr_report, fb->attempt, fb->toa,
 		agc_inp_dbm8_by_pm(fb->pm)/8, ANGLE_TO_FREQ(fb->angle));
 #endif
@@ -179,8 +179,6 @@ static int l1s_sbdet_resp(__unused uint8_t p1, uint8_t attempt,
 	int qbits, fn_offset;
 	struct l1_cell_info *cinfo = &l1s.serving_cell;
 	int fnr_delta, bits_delta;
-	struct l1ctl_sync_new_ccch_resp *l1;
-	struct msgb *msg;
 
 	putchart('s');
 
@@ -203,7 +201,7 @@ static int l1s_sbdet_resp(__unused uint8_t p1, uint8_t attempt,
 
 	sb = dsp_api.db_r->a_sch[3] | dsp_api.db_r->a_sch[4] << 16;
 	fbs.mon.bsic = l1s_decode_sb(&fbs.mon.time, sb);
-	printf("=> SB 0x%08x: BSIC=%u ", sb, fbs.mon.bsic);
+	printf("=> SB 0x%08"PRIx32": BSIC=%u ", sb, fbs.mon.bsic);
 	l1s_time_dump(&fbs.mon.time);
 
 	l1s.serving_cell.bsic = fbs.mon.bsic;
@@ -482,9 +480,9 @@ static int l1s_fbdet_resp(__unused uint8_t p1, uint8_t attempt,
 
 			int fn_offset = l1s.current_time.fn - last_fb->attempt + ntdma;
 			int delay = fn_offset + 11 - l1s.current_time.fn - 1;
-			printf("  fn_offset=%d (fn=%u + attempt=%u + ntdma = %d)\n",
+			printf("  fn_offset=%d (fn=%"PRIu32" + attempt=%u + ntdma = %d)\n",
 				fn_offset, l1s.current_time.fn, last_fb->attempt, ntdma);
-			printf("  delay=%d (fn_offset=%d + 11 - fn=%u - 1\n", delay,
+			printf("  delay=%d (fn_offset=%d + 11 - fn=%"PRIu32" - 1\n", delay,
 				fn_offset, l1s.current_time.fn);
 			printf("  scheduling next FB/SB detection task with delay %u\n", delay);
 			if (abs(last_fb->freq_diff) < fbs.req.freq_err_thresh2 &&
@@ -524,11 +522,10 @@ static const struct tdma_sched_item fb_sched_set[] = {
 /* Asynchronous completion handler for FB detection */
 static void l1a_fb_compl(__unused enum l1_compl c)
 {
-	struct l1_cell_info *cinfo = &l1s.serving_cell;
-
 	if (last_fb->attempt >= 13) {
 		/* FB detection failed, signal this via L1CTL */
-		return l1ctl_fbsb_resp(255);
+		l1ctl_fbsb_resp(255);
+		return;
 	}
 
 	/* FIME: use l1s.neigh_cell[fbs.cinfo_idx] */
diff --git a/src/target/firmware/layer1/prim_freq.c b/src/target/firmware/layer1/prim_freq.c
index ca6dc9e..01f39d4 100644
--- a/src/target/firmware/layer1/prim_freq.c
+++ b/src/target/firmware/layer1/prim_freq.c
@@ -24,7 +24,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-
+#include <inttypes.h>
 #include <defines.h>
 #include <debug.h>
 #include <memory.h>
@@ -103,7 +103,7 @@ void l1a_freq_req(uint32_t fn_sched)
 	fn_sched = l1s.current_time.fn + diff;
 	if (fn_sched >= GSM_MAX_FN)
 		fn_sched -= GSM_MAX_FN;
-	printf("Scheduling frequency change at fn=%u, currently fn=%u\n",
+	printf("Scheduling frequency change at fn=%"PRIu32", currently fn=%"PRIu32"\n",
 		fn_sched, l1s.current_time.fn);
 
 	local_firq_save(flags);
diff --git a/src/target/firmware/layer1/prim_rach.c b/src/target/firmware/layer1/prim_rach.c
index 08353ef..e6ea656 100644
--- a/src/target/firmware/layer1/prim_rach.c
+++ b/src/target/firmware/layer1/prim_rach.c
@@ -58,7 +58,6 @@ struct {
 /* p1: type of operation (0: one NB, 1: one RACH burst, 2: four NB */
 static int l1s_tx_rach_cmd(__unused uint8_t p1, __unused uint8_t p2, __unused uint16_t p3)
 {
-	int i;
 	uint16_t  *info_ptr;
 	uint16_t arfcn;
 	uint8_t data[2];
diff --git a/src/target/firmware/layer1/prim_tx_nb.c b/src/target/firmware/layer1/prim_tx_nb.c
index 71b32eb..86e8224 100644
--- a/src/target/firmware/layer1/prim_tx_nb.c
+++ b/src/target/firmware/layer1/prim_tx_nb.c
@@ -75,7 +75,6 @@ static int l1s_tx_cmd(uint8_t p1, uint8_t burst_id, uint16_t p3)
 {
 	uint16_t arfcn;
 	uint8_t tsc, tn;
-	uint8_t mf_task_id = p3 & 0xff;
 	uint8_t mf_task_flags = p3 >> 8;
 
 	putchart('T');
-- 
1.8.3.2


--------------010704040601010603020704--




More information about the baseband-devel mailing list