Skip to contentSkip to conversation

Fix sparse warnings

PATCH Superseded Ashok Reddy Soma 2 participants 6 messages Jan 20, 2023 – Jan 27, 2023

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Fix sparse warnings

Run and fix sparse warnings in below files
-drivers/mmc/zynq_sdhci.c
-board/xilinx/common/board.h
-drivers/gpio/zynqmp_gpio_modepin.c
-board/xilinx/versal/board.c

Changes in v2:
- Included header file instead of declaring prototype
- Modified description to reflect the same
- Instead of removing ret variable, take it and return incase of error.
- Updated description as per this.
- Changed subject from missing prototype to missing header
- Moved include file in alphabetical order
- Updated description

Algapally Santosh Sagar (4):
xilinx: common: Include header file to fix warning
gpio: zynqmp: Handle error from get_gpio_modepin
xilinx: versal: Add missing header
drivers: mmc: Change datatype of tuning_loop_counter to int

 board/xilinx/common/board.c        | 1 +
 board/xilinx/versal/board.c        | 1 +
 drivers/gpio/zynqmp_gpio_modepin.c | 3 +++
 drivers/mmc/zynq_sdhci.c           | 2 +-
 4 files changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/4 xilinx: common: Include header file to fix warning

From: Algapally Santosh Sagar <[email protected]>

Prototype is missing for board_get_usable_ram_top, which is pointed by below sparse warning. Include init.h header file to fix this.

warning: no previous prototype for 'board_get_usable_ram_top' [-Wmissing-prototypes].

---

Changes in v2:
- Included header file instead of declaring prototype
- Modified description to reflect the same

 board/xilinx/common/board.c | 1 +
 1 file changed, 1 insertion(+)
board/xilinx/common/board.c +1 -0
index 59d87f2352..a5bd289776 100644
@@ -9,6 +9,7 @@
 #include <efi_loader.h>
 #include <env.h>
 #include <image.h>
+#include <init.h>
 #include <lmb.h>
 #include <log.h>
 #include <asm/global_data.h>
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/4 gpio: zynqmp: Handle error from get_gpio_modepin

In reply to Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

There is a unused variable ret, due to which we are getting sparse warning as below.
warning: variable 'ret' set but not used [-Wunused-but-set-variable].

Return ret incase of error.

---

Changes in v2:
- Instead of removing ret variable, take it and return incase of error.
- Updated description as per this.

 drivers/gpio/zynqmp_gpio_modepin.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpio/zynqmp_gpio_modepin.c +3 -0
index 078fd83395..e9565ff543 100644
@@ -48,6 +48,9 @@ static int modepin_gpio_set_value(struct udevice *dev, unsigned int offset,
 	int ret;
 
 	ret = get_gpio_modepin(ret_payload);
+	if (ret)
+		return ret;
+
 	if (value)
 		out_val = OUTVAL(offset) | ret_payload[1];
 	else
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 3/4 xilinx: versal: Add missing header

In reply to Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

Add missing prototype to fix the sparse warning, warning: no previous prototype for 'do_go_exec' [-Wmissing-prototypes].

---

Changes in v2:
- Changed subject from missing prototype to missing header
- Moved include file in alphabetical order

 board/xilinx/versal/board.c | 1 +
 1 file changed, 1 insertion(+)
board/xilinx/versal/board.c +1 -0
index f9f5457ed2..4cdc2ecd1d 100644
@@ -4,6 +4,7 @@
  * Michal Simek <[email protected]>
  */
 
+#include <command.h>
 #include <common.h>
 #include <cpu_func.h>
 #include <env.h>
Signature · 1 line
2.17.1
#4 lore raw

PATCH v2 4/4 drivers: mmc: Change datatype of tuning_loop_counter to int

In reply to Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

tuning_loop_counter is of char type, which is not capable of handling the entire data range of this variable. This is pointed by below sparse warning. Change datatype to int to fix this.
warning: comparison is always false due to limited range of data type.

---

Changes in v2:
- Updated description

 drivers/mmc/zynq_sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/zynq_sdhci.c +1 -1
index 7dcf6ad842..be4075c97a 100644
@@ -249,7 +249,7 @@ static int arasan_sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
 	u32 ctrl;
 	struct sdhci_host *host;
 	struct arasan_sdhci_priv *priv = dev_get_priv(mmc->dev);
-	char tuning_loop_counter = SDHCI_TUNING_LOOP_COUNT;
+	int tuning_loop_counter = SDHCI_TUNING_LOOP_COUNT;
 
 	dev_dbg(mmc->dev, "%s\n", __func__);
 
Signature · 1 line
2.17.1
maintainer
#5 lore raw
In reply to Ashok Reddy Soma
Quoted 21 lines · Ashok Reddy Soma

Run and fix sparse warnings in below files
-drivers/mmc/zynq_sdhci.c
-board/xilinx/common/board.h
-drivers/gpio/zynqmp_gpio_modepin.c
-board/xilinx/versal/board.c

Changes in v2:
- Included header file instead of declaring prototype
- Modified description to reflect the same
- Instead of removing ret variable, take it and return incase of error.
- Updated description as per this.
- Changed subject from missing prototype to missing header
- Moved include file in alphabetical order
- Updated description

Algapally Santosh Sagar (4):
xilinx: common: Include header file to fix warning
gpio: zynqmp: Handle error from get_gpio_modepin
xilinx: versal: Add missing header
drivers: mmc: Change datatype of tuning_loop_counter to int

Quoted 6 lines
  board/xilinx/common/board.c        | 1 +
  board/xilinx/versal/board.c        | 1 +
  drivers/gpio/zynqmp_gpio_modepin.c | 3 +++
  drivers/mmc/zynq_sdhci.c           | 2 +-
  4 files changed, 6 insertions(+), 1 deletion(-)

Applied all.
M