[PATCH 4/8] firmware: correct pointer inits and assignments

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/baseband-devel@lists.osmocom.org/.

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


this eliminates the occurrance of gcc warnings
warning: initialization from incompatible pointer type
warning: assignment from incompatible pointer type
---
 src/target/firmware/apps/loader/main.c     |    2 +-
 src/target/firmware/apps/loader_mtk/main.c |    2 +-
 src/target/firmware/display/ssd1783.c      |    2 +-
 src/target/firmware/display/ssd1963.c      |    2 +-
 src/target/firmware/display/td014.c        |    2 +-
 src/target/firmware/layer1/prim_pm.c       |    4 ++--
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/target/firmware/apps/loader/main.c b/src/target/firmware/apps/loader/main.c
index de2193a..602297b 100644
--- a/src/target/firmware/apps/loader/main.c
+++ b/src/target/firmware/apps/loader/main.c
@@ -308,7 +308,7 @@ 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);
 
diff --git a/src/target/firmware/apps/loader_mtk/main.c b/src/target/firmware/apps/loader_mtk/main.c
index 0bc4ab8..4345443 100644
--- a/src/target/firmware/apps/loader_mtk/main.c
+++ b/src/target/firmware/apps/loader_mtk/main.c
@@ -249,7 +249,7 @@ 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);
 
diff --git a/src/target/firmware/display/ssd1783.c b/src/target/firmware/display/ssd1783.c
index 7f96c1e..71c3cf3 100644
--- a/src/target/firmware/display/ssd1783.c
+++ b/src/target/firmware/display/ssd1783.c
@@ -237,7 +237,7 @@ static void ssd1783_set_attr(__unused unsigned long attr)
 	/* FIXME */
 }
 
-static int ssd1783_putc(unsigned int c)
+static int ssd1783_putc(unsigned char c)
 {
 	return ssd1783_putc_col(c, BLACK, WHITE);
 }
diff --git a/src/target/firmware/display/ssd1963.c b/src/target/firmware/display/ssd1963.c
index 7c453a5..0b2c49f 100644
--- a/src/target/firmware/display/ssd1963.c
+++ b/src/target/firmware/display/ssd1963.c
@@ -188,7 +188,7 @@ static void ssd1963_set_attr(__unused unsigned long attr)
 	/* FIXME */
 }
 
-static int ssd1963_putc(unsigned int c)
+static int ssd1963_putc(unsigned char c)
 {
 	return ssd1963_putc_col(c, BLACK, WHITE);
 }
diff --git a/src/target/firmware/display/td014.c b/src/target/firmware/display/td014.c
index df04c13..b4dd1c0 100644
--- a/src/target/firmware/display/td014.c
+++ b/src/target/firmware/display/td014.c
@@ -165,7 +165,7 @@ static void td014_set_attr(__unused unsigned long attr)
 	/* FIXME */
 }
 
-static int td014_putc(unsigned int c)
+static int td014_putc(unsigned char c)
 {
 	return td014_putc_col(c, BLACK, WHITE);
 }
diff --git a/src/target/firmware/layer1/prim_pm.c b/src/target/firmware/layer1/prim_pm.c
index c2d85ac..640f960 100644
--- a/src/target/firmware/layer1/prim_pm.c
+++ b/src/target/firmware/layer1/prim_pm.c
@@ -108,7 +108,7 @@ static int l1s_pm_resp(uint8_t num_meas, __unused uint8_t p2,
 		l1s.pm.msg = l1ctl_msgb_alloc(L1CTL_PM_CONF);
 	}
 
-	pmr = msgb_put(l1s.pm.msg, sizeof(*pmr));
+	pmr = (struct l1ctl_pm_conf *)msgb_put(l1s.pm.msg, sizeof(*pmr));
 	pmr->band_arfcn = htons(arfcn);
 	/* FIXME: do this as RxLev rather than DBM8 ? */
 	pmr->pm[0] = dbm2rxlev(agc_inp_dbm8_by_pm(pm_level[0])/8);
@@ -124,7 +124,7 @@ static int l1s_pm_resp(uint8_t num_meas, __unused uint8_t p2,
 			l1s.pm.range.arfcn_next++;
 		} else {
 			/* we have finished, flush the msgb to L2 */
-			struct l1ctl_hdr *l1h = l1s.pm.msg->l1h;
+			struct l1ctl_hdr *l1h = (struct l1ctl_hdr *)l1s.pm.msg->l1h;
 			l1h->flags |= L1CTL_F_DONE;
 			l1_queue_for_l2(l1s.pm.msg);
 			l1s.pm.msg = NULL;
-- 
1.7.8.rc1





More information about the baseband-devel mailing list