Skip to contentSkip to conversation

Several patch to solve warning on stm32mp1 board with W=1

PATCH New Patrick Delaunay 2 participants 13 messages Jan 28, 2020 – Feb 14, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Several patch to solve warning on stm32mp1 board with W=1

Hi,

this serie includes few remaining patches on STM32 drivers or board code to avoid warning when the board stm32mp1 is compiled with W=1.

See also patches on:
- ENV (V2): http://patchwork.ozlabs.org/patch/1230200/
- MTD (merged): http://patchwork.ozlabs.org/patch/1228814/

Regards

Patrick Delaunay (4):
board: stm32mp1: board: add include for dfu
board: stm32mp1: change dfu function to static
pinctrl: stmfx: update the result type of dm_i2c_reg_read
clk: stm32mp1: solve type issue in stm32mp1_lse_enable and
stm32mp1_clktree

 board/st/stm32mp1/stm32mp1.c    | 5 +++--
 drivers/clk/clk_stm32mp1.c      | 9 +++++----
 drivers/pinctrl/pinctrl-stmfx.c | 7 ++++---
 3 files changed, 12 insertions(+), 9 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/4 board: stm32mp1: board: add include for dfu

Add include for dfu, add prototype for set_dfu_alt_info and avoid warning when compiling with W=1.

---

 board/st/stm32mp1/stm32mp1.c | 1 +
 1 file changed, 1 insertion(+)
board/st/stm32mp1/stm32mp1.c +1 -0
index e82a43074f..2fecfc1b16 100644
@@ -7,6 +7,7 @@
 #include <bootm.h>
 #include <clk.h>
 #include <config.h>
+#include <dfu.h>
 #include <dm.h>
 #include <env.h>
 #include <env_internal.h>
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/4 board: stm32mp1: board: add include for dfu

Quoted 14 lines · Patrick Delaunay

Add include for dfu, add prototype for set_dfu_alt_info and avoid warning when compiling with W=1.

---

 board/st/stm32mp1/stm32mp1.c | 1 +
 1 file changed, 1 insertion(+)
board/st/stm32mp1/stm32mp1.c +0 -0
index e82a43074f..2fecfc1b16 100644

board/st/stm32mp1/stm32mp1.c line 13

Quoted 7 lines
board/st/stm32mp1/stm32mp1.c +1 -0
@@ -7,6 +7,7 @@
 #include <bootm.h>
 #include <clk.h>
 #include <config.h>
+#include <dfu.h>
 #include <dm.h>
 #include <env.h>
 #include <env_internal.h>

Thanks

#4 lore raw

PATCH 2/4 board: stm32mp1: change dfu function to static

In reply to Patrick Delaunay

Change the dfu functions dfu_otp_read and dfu_pmic_read to static, this patch avoids warning when compiling with W=1.

---

 board/st/stm32mp1/stm32mp1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/st/stm32mp1/stm32mp1.c +2 -2
index 2fecfc1b16..b6b70ce20f 100644
@@ -1010,7 +1010,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
 #include <dfu.h>
 #include <power/stpmic1.h>
 
-int dfu_otp_read(u64 offset, u8 *buffer, long *size)
+static int dfu_otp_read(u64 offset, u8 *buffer, long *size)
 {
 	struct udevice *dev;
 	int ret;
@@ -1030,7 +1030,7 @@ int dfu_otp_read(u64 offset, u8 *buffer, long *size)
 	return 0;
 }
 
-int dfu_pmic_read(u64 offset, u8 *buffer, long *size)
+static int dfu_pmic_read(u64 offset, u8 *buffer, long *size)
 {
 	int ret;
 #ifdef CONFIG_PMIC_STPMIC1
Signature · 1 line
2.17.1
#5 lore raw

PATCH 2/4 board: stm32mp1: change dfu function to static

Quoted 23 lines · Patrick Delaunay

Change the dfu functions dfu_otp_read and dfu_pmic_read to static, this patch avoids warning when compiling with W=1.

---

 board/st/stm32mp1/stm32mp1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/st/stm32mp1/stm32mp1.c +1 -1
index 2fecfc1b16..b6b70ce20f 100644
@@ -1010,7 +1010,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
 #include <dfu.h>
 #include <power/stpmic1.h>
 
-int dfu_otp_read(u64 offset, u8 *buffer, long *size)
+static int dfu_otp_read(u64 offset, u8 *buffer, long *size)
 {
 	struct udevice *dev;
 	int ret;

board/st/stm32mp1/stm32mp1.c int dfu_otp_read(u64 offset, u8 *buffer, long *size) · line 1036

Quoted 8 lines
board/st/stm32mp1/stm32mp1.c +1 -1
@@ -1030,7 +1030,7 @@ int dfu_otp_read(u64 offset, u8 *buffer, long *size)
 	return 0;
 }
 
-int dfu_pmic_read(u64 offset, u8 *buffer, long *size)
+static int dfu_pmic_read(u64 offset, u8 *buffer, long *size)
 {
 	int ret;
 #ifdef CONFIG_PMIC_STPMIC1

Thanks

#6 lore raw

PATCH 2/4 board: stm32mp1: change dfu function to static

In reply to Patrick Delaunay

Hi,

Quoted 8 lines

From: Patrick DELAUNAY <[email protected]>
Sent: mardi 28 janvier 2020 10:44
To: u-boot at lists.denx.de
Cc: Patrick DELAUNAY <[email protected]>; U-Boot STM32 <uboot- stm32 at st-md-mailman.stormreply.com>
Subject: [PATCH 2/4] board: stm32mp1: change dfu function to static
Importance: High

Quoted 5 lines

Change the dfu functions dfu_otp_read and dfu_pmic_read to static, this patch avoids warning when compiling with W=1.

---

Applied to u-boot-stm32/master, thanks!

Regards
Patrick

#7 lore raw

PATCH 3/4 pinctrl: stmfx: update the result type of dm_i2c_reg_read

In reply to Patrick Delaunay

Use int as result of dm_i2c_reg_read to avoid warning with W=1 (warning: comparison is always false due to limited range of data type [-Wtype-limits])

---

 drivers/pinctrl/pinctrl-stmfx.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-stmfx.c +4 -3
index 0b5a0433cd..0def27166e 100644
@@ -351,11 +351,12 @@ static int stmfx_chip_init(struct udevice *dev)
 	int ret;
 	struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
 
-	id = dm_i2c_reg_read(dev, STMFX_REG_CHIP_ID);
-	if (id < 0) {
-		dev_err(dev, "error reading chip id: %d\n", id);
+	ret = dm_i2c_reg_read(dev, STMFX_REG_CHIP_ID);
+	if (ret < 0) {
+		dev_err(dev, "error reading chip id: %d\n", ret);
 		return ret;
 	}
+	id = (u8)ret;
 	/*
 	 * Check that ID is the complement of the I2C address:
 	 * STMFX I2C address follows the 7-bit format (MSB), that's why
Signature · 1 line
2.17.1
#8 lore raw

PATCH 3/4 pinctrl: stmfx: update the result type of dm_i2c_reg_read

Quoted 20 lines · Patrick Delaunay

Use int as result of dm_i2c_reg_read to avoid warning with W=1 (warning: comparison is always false due to limited range of data type [-Wtype-limits])

---

 drivers/pinctrl/pinctrl-stmfx.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-stmfx.c +0 -2
index 0b5a0433cd..0def27166e 100644
@@ -351,11 +351,12 @@ static int stmfx_chip_init(struct udevice *dev)
 	int ret;
 	struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
 
-	id = dm_i2c_reg_read(dev, STMFX_REG_CHIP_ID);
-	if (id < 0) {

drivers/pinctrl/pinctrl-stmfx.c static int stmfx_chip_init(struct udevice *dev) · line 362

Quoted 10 lines
drivers/pinctrl/pinctrl-stmfx.c +4 -1
-		dev_err(dev, "error reading chip id: %d\n", id);
+	ret = dm_i2c_reg_read(dev, STMFX_REG_CHIP_ID);
+	if (ret < 0) {
+		dev_err(dev, "error reading chip id: %d\n", ret);
 		return ret;
 	}
+	id = (u8)ret;
 	/*
 	 * Check that ID is the complement of the I2C address:
 	 * STMFX I2C address follows the 7-bit format (MSB), that's why

Thanks

#9 lore raw

PATCH 3/4 pinctrl: stmfx: update the result type of dm_i2c_reg_read

In reply to Patrick Delaunay

Hi,

Quoted 9 lines

From: Patrick DELAUNAY <[email protected]>
Sent: mardi 28 janvier 2020 10:44

Use int as result of dm_i2c_reg_read to avoid warning with
W=1 (warning: comparison is always false due to limited range of data type [- Wtype-limits])

---

Applied to u-boot-stm32/master, thanks!

Regards
Patrick

#10 lore raw

PATCH 4/4 clk: stm32mp1: solve type issue in stm32mp1_lse_enable and stm32mp1_clktree

In reply to Patrick Delaunay

Solve type issue in stm32mp1_lse_enable and stm32mp1_clktree.

This patch solves the warnings when compiling with W=1 on stm32mp1 board:

clk_stm32mp1.c: In function ‘stm32mp1_lse_enable’:
clk_stm32mp1.c:1238:15: warning: comparison of integer expressions
of different signedness: ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
clk_stm32mp1.c:1239:13: warning: comparison of integer expressions
of different signedness: ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]

clk_stm32mp1.c: In function ‘stm32mp1_clktree’:
clk_stm32mp1.c:1814:17: warning: comparison of integer expressions
of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]

---

 drivers/clk/clk_stm32mp1.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/clk_stm32mp1.c +5 -4
index da66bde41b..fd8c821e48 100644
@@ -1218,7 +1218,7 @@ static int stm32mp1_osc_wait(int enable, fdt_addr_t rcc, u32 offset,
 }
 
 static void stm32mp1_lse_enable(fdt_addr_t rcc, int bypass, int digbyp,
-				int lsedrv)
+				u32 lsedrv)
 {
 	u32 value;
 
@@ -1651,8 +1651,8 @@ static int stm32mp1_clktree(struct udevice *dev)
 	unsigned int clkdiv[CLKDIV_NB];
 	unsigned int pllcfg[_PLL_NB][PLLCFG_NB];
 	ofnode plloff[_PLL_NB];
-	int ret;
-	int i, len;
+	int ret, len;
+	uint i;
 	int lse_css = 0;
 	const u32 *pkcs_cell;
 
@@ -1698,7 +1698,8 @@ static int stm32mp1_clktree(struct udevice *dev)
 		stm32mp1_lsi_set(rcc, 1);
 
 	if (priv->osc[_LSE]) {
-		int bypass, digbyp, lsedrv;
+		int bypass, digbyp;
+		u32 lsedrv;
 		struct udevice *dev = priv->osc_dev[_LSE];
 
 		bypass = dev_read_bool(dev, "st,bypass");
Signature · 1 line
2.17.1
#11 lore raw

PATCH 4/4 clk: stm32mp1: solve type issue in stm32mp1_lse_enable and stm32mp1_clktree

Quoted 49 lines · Patrick Delaunay

Solve type issue in stm32mp1_lse_enable and stm32mp1_clktree.

This patch solves the warnings when compiling with W=1 on stm32mp1 board:

clk_stm32mp1.c: In function ?stm32mp1_lse_enable?:
clk_stm32mp1.c:1238:15: warning: comparison of integer expressions
of different signedness: ?u32? {aka ?unsigned int?} and ?int? [-Wsign-compare]
clk_stm32mp1.c:1239:13: warning: comparison of integer expressions
of different signedness: ?u32? {aka ?unsigned int?} and ?int? [-Wsign-compare]

clk_stm32mp1.c: In function ?stm32mp1_clktree?:
clk_stm32mp1.c:1814:17: warning: comparison of integer expressions
of different signedness: ?int? and ?unsigned int? [-Wsign-compare]

---

 drivers/clk/clk_stm32mp1.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/clk_stm32mp1.c +3 -3
index da66bde41b..fd8c821e48 100644
@@ -1218,7 +1218,7 @@ static int stm32mp1_osc_wait(int enable, fdt_addr_t rcc, u32 offset,
 }
 
 static void stm32mp1_lse_enable(fdt_addr_t rcc, int bypass, int digbyp,
-				int lsedrv)
+				u32 lsedrv)
 {
 	u32 value;
 
@@ -1651,8 +1651,8 @@ static int stm32mp1_clktree(struct udevice *dev)
 	unsigned int clkdiv[CLKDIV_NB];
 	unsigned int pllcfg[_PLL_NB][PLLCFG_NB];
 	ofnode plloff[_PLL_NB];
-	int ret;
-	int i, len;
+	int ret, len;
+	uint i;
 	int lse_css = 0;
 	const u32 *pkcs_cell;
 

drivers/clk/clk_stm32mp1.c static int stm32mp1_clktree(struct udevice *dev) · line 1705

Quoted 9 lines
drivers/clk/clk_stm32mp1.c +2 -1
@@ -1698,7 +1698,8 @@ static int stm32mp1_clktree(struct udevice *dev)
 		stm32mp1_lsi_set(rcc, 1);
 
 	if (priv->osc[_LSE]) {
-		int bypass, digbyp, lsedrv;
+		int bypass, digbyp;
+		u32 lsedrv;
 		struct udevice *dev = priv->osc_dev[_LSE];
 
 		bypass = dev_read_bool(dev, "st,bypass");

Thanks

#12 lore raw

PATCH 4/4 clk: stm32mp1: solve type issue in stm32mp1_lse_enable and stm32mp1_clktree

In reply to Patrick Delaunay

Hi,

Quoted 15 lines

From: Patrick DELAUNAY <[email protected]>
Sent: mardi 28 janvier 2020 10:44

Solve type issue in stm32mp1_lse_enable and stm32mp1_clktree.

This patch solves the warnings when compiling with W=1 on stm32mp1 board:

clk_stm32mp1.c: In function ?stm32mp1_lse_enable?:
clk_stm32mp1.c:1238:15: warning: comparison of integer expressions
of different signedness: ?u32? {aka ?unsigned int?} and ?int? [-Wsign-compare]
clk_stm32mp1.c:1239:13: warning: comparison of integer expressions
of different signedness: ?u32? {aka ?unsigned int?} and ?int? [-Wsign-compare]

Quoted 7 lines

clk_stm32mp1.c: In function ?stm32mp1_clktree?:
clk_stm32mp1.c:1814:17: warning: comparison of integer expressions
of different signedness: ?int? and ?unsigned int? [-Wsign-compare]

---

Applied to u-boot-stm32/master, thanks!

Regards
Patrick