Fix sparse warnings
Subsystems (3)
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
Algapally Santosh Sagar (4):
xilinx: common: Add missing prototype for board_get_usable_ram_top
gpio: zynqmp: Remove unused variable ret
xilinx: versal: Add missing prototype
drivers: mmc: Change datatype to fix a warning
board/xilinx/common/board.h | 4 ++++ board/xilinx/versal/board.c | 1 + drivers/gpio/zynqmp_gpio_modepin.c | 3 +-- drivers/mmc/zynq_sdhci.c | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/4 xilinx: common: Add missing prototype for board_get_usable_ram_top
From: Algapally Santosh Sagar <[email protected]>
Add missing prototype to fix the sparse warning, warning: no previous prototype for 'board_get_usable_ram_top' [-Wmissing-prototypes].
---
board/xilinx/common/board.h | 4 ++++ 1 file changed, 4 insertions(+)
board/xilinx/common/board.h +4 -0
@@ -11,4 +11,8 @@ int board_late_init_xilinx(void);int xilinx_read_eeprom (void ); +#if defined(CONFIG_LMB ) +phys_size_t board_get_usable_ram_top (phys_size_t total_size); +#endif +#endif /* BOARD_XILINX_COMMON_BOARD_H */
Signature · 1 line
2.17.1
Michal Simek
maintainerRe: [PATCH 1/4] xilinx: common: Add missing prototype for board_get_usable_ram_top
Quoted 17 lines · Ashok Reddy Soma
From: Algapally Santosh Sagar <[email protected]>
Add missing prototype to fix the sparse warning, warning: no previous prototype for '
board_get_usable_ram_top' [-Wmissing-prototypes].Signed-off-by Algapally Santosh Sagar <[email protected]>Signed-off-by Ashok Reddy Soma <[email protected]>---
board/xilinx/common/board.h | 4 ++++ 1 file changed, 4 insertions(+)board/xilinx/common/board.h +0
-0
board/xilinx/common/board.h int board_late_init_xilinx(void); · line 15
Quoted 5 lines
board/xilinx/common/board.h +2
-0@@ -11,4 +11,8 @@ int board_late_init_xilinx(void);int xilinx_read_eeprom (void ); +#if defined(CONFIG_LMB ) +phys_size_t board_get_usable_ram_top (phys_size_t total_size);
it is already in include/init.h.
M
PATCH 2/4 gpio: zynqmp: Remove unused variable ret
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].
Remove variable ret.
---
drivers/gpio/zynqmp_gpio_modepin.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpio/zynqmp_gpio_modepin.c +1 -2
@@ -45,9 +45,8 @@ static int modepin_gpio_set_value(struct udevice *dev, unsigned int offset, {u32 ret_payload[PAYLOAD_ARG_CNT ];u32 out_val =0 ; -int ret; - ret =get_gpio_modepin (ret_payload); +get_gpio_modepin (ret_payload);if (value) out_val =OUTVAL (offset) | ret_payload[1 ];else
Signature · 1 line
2.17.1
Michal Simek
maintainerRe: [PATCH 2/4] gpio: zynqmp: Remove unused variable ret
Quoted 20 lines · 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].Remove variable ret.
Signed-off-by Algapally Santosh Sagar <[email protected]>Signed-off-by Ashok Reddy Soma <[email protected]>---
drivers/gpio/zynqmp_gpio_modepin.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpio/zynqmp_gpio_modepin.c +0
-0
drivers/gpio/zynqmp_gpio_modepin.c static int modepin_gpio_set_value(struct udevice *dev, unsigned int offset, · line 49
Quoted 7 lines
drivers/gpio/zynqmp_gpio_modepin.c +1
-2@@ -45,9 +45,8 @@ static int modepin_gpio_set_value(struct udevice *dev, unsigned int offset, {u32 ret_payload[PAYLOAD_ARG_CNT ];u32 out_val =0 ; -int ret; - ret =get_gpio_modepin (ret_payload); +get_gpio_modepin (ret_payload);
:-) what about return error if get_gpio_modepin fails?
M
Quoted 3 lines
drivers/gpio/zynqmp_gpio_modepin.c +0
-0if (value) out_val =OUTVAL (offset) | ret_payload[1 ];else
PATCH 3/4 xilinx: versal: Add missing prototype
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].
---
board/xilinx/versal/board.c | 1 + 1 file changed, 1 insertion(+)
board/xilinx/versal/board.c +1 -0
@@ -22,6 +22,7 @@#include <dm/uclass.h> #include <versalpl.h> #include "../common/board.h" +#include <command.h> DECLARE_GLOBAL_DATA_PTR ;
Signature · 1 line
2.17.1
Michal Simek
maintainerRe: [PATCH 3/4] xilinx: versal: Add missing prototype
Add missing header in subject?
Quoted 17 lines · 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].Signed-off-by Algapally Santosh Sagar <[email protected]>Signed-off-by Ashok Reddy Soma <[email protected]>---
board/xilinx/versal/board.c | 1 + 1 file changed, 1 insertion(+)board/xilinx/versal/board.c +0
-0
board/xilinx/versal/board.c line 25
Quoted 4 lines
board/xilinx/versal/board.c +1
-0@@ -22,6 +22,7 @@#include <dm/uclass.h> #include <versalpl.h> #include "../common/board.h" +#include <command.h>
alphabetic order please.
M
Quoted 3 lines
board/xilinx/versal/board.c +0
-0DECLARE_GLOBAL_DATA_PTR ;
PATCH 4/4 drivers: mmc: Change datatype to fix a warning
In reply to Ashok Reddy SomaFrom: Algapally Santosh Sagar <[email protected]>
tuning_loop_counter is of char type. Change to int to fix below warning.
warning: comparison is always false due to limited range of data type.
---
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
maintainerRe: [PATCH 4/4] drivers: mmc: Change datatype to fix a warning
mmc: zynq_sdhci: Fix wrong tuning_loop_counter datatype
Quoted 4 lines · Ashok Reddy Soma
From: Algapally Santosh Sagar <[email protected]>
tuning_loop_counteris of char type. Change to int to fix below warning.
warning: comparison is always false due to limited range of data type.
Conceptually description should be done a way that you say I fixed this issue because datatype wasn't correct. And this was reported by spare.
And you are doing it because it is not correct not because there is a warning. Warning just points to it.
M
Quoted 21 lines
Signed-off-by Algapally Santosh Sagar <[email protected]>Signed-off-by Ashok Reddy Soma <[email protected]>---
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__);
Michal Simek
maintainerQuoted 13 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.cAlgapally Santosh Sagar (4):
xilinx: common: Add missing prototype forboard_get_usable_ram_top
gpio: zynqmp: Remove unused variable ret
xilinx: versal: Add missing prototype
drivers: mmc: Change datatype to fix a warning
Quoted 6 lines
board/xilinx/common/board.h | 4 ++++ board/xilinx/versal/board.c | 1 + drivers/gpio/zynqmp_gpio_modepin.c | 3 +-- drivers/mmc/zynq_sdhci.c | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-)
Please do it against upstream.
M