Fix sparse warnings
Subsystems (3)
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
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
@@ -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
PATCH v2 2/4 gpio: zynqmp: Handle error from get_gpio_modepin
In reply to Ashok Reddy SomaFrom: 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
@@ -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
PATCH v2 3/4 xilinx: versal: Add missing header
In reply to Ashok Reddy SomaFrom: 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
@@ -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
PATCH v2 4/4 drivers: mmc: Change datatype of tuning_loop_counter to int
In reply to Ashok Reddy SomaFrom: 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
@@ -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
Michal Simek
maintainerQuoted 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.cChanges 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 descriptionAlgapally Santosh Sagar (4):
xilinx: common: Include header file to fix warning
gpio: zynqmp: Handle error fromget_gpio_modepin
xilinx: versal: Add missing header
drivers: mmc: Change datatype oftuning_loop_counterto 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