[PATCH 0/6] Fix sparse warnings in zynq platform

Fix below sparse warnings - Add missing prototype for zynqmp_mmio_write - Add missing prototype for zynq_qspi_mem_exec_op - Change datatype of status and ecc_status from u32 to int - Pass the missing argument type in function definition - Add the missing function prototypes - Add missing prototype for xilinx_qspi_mem_exec_op
Algapally Santosh Sagar (6): spi: xilinx_spi: Add missing prototype for xilinx_qspi_mem_exec_op xilinx: zynq: Add missing prototype for zynqmp_mmio_write spi: zynq_qspi: Add missing prototype for zynq_qspi_mem_exec_op mtd: nand: zynq_nand: Change datatype of status and ecc_status to int arm: zynq: Pass the missing argument type in function definition xilinx: zynq: Add the missing function prototypes
arch/arm/mach-zynq/include/mach/sys_proto.h | 1 + board/xilinx/zynq/board.c | 2 ++ board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c | 4 ++-- drivers/mtd/nand/raw/zynq_nand.c | 4 ++-- drivers/spi/xilinx_spi.c | 4 ++-- drivers/spi/zynq_qspi.c | 4 ++-- 6 files changed, 11 insertions(+), 8 deletions(-)

From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
Add missing prototype to fix the below sparse warning warning: no previous prototype for 'xilinx_qspi_mem_exec_op' [-Wmissing-prototypes]
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com ---
drivers/spi/xilinx_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index 33575fe757..b58a3f632a 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -363,8 +363,8 @@ static int xilinx_qspi_check_buswidth(struct spi_slave *slave, u8 width) return -EOPNOTSUPP; }
-bool xilinx_qspi_mem_exec_op(struct spi_slave *slave, - const struct spi_mem_op *op) +static bool xilinx_qspi_mem_exec_op(struct spi_slave *slave, + const struct spi_mem_op *op) { if (xilinx_qspi_check_buswidth(slave, op->cmd.buswidth)) return false;

From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
Add missing prototype to fix the sparse warning, warning: no previous prototype for 'zynqmp_mmio_write' [-Wmissing-prototypes].
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com ---
arch/arm/mach-zynq/include/mach/sys_proto.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-zynq/include/mach/sys_proto.h b/arch/arm/mach-zynq/include/mach/sys_proto.h index 268ec50ad8..74f9665fbb 100644 --- a/arch/arm/mach-zynq/include/mach/sys_proto.h +++ b/arch/arm/mach-zynq/include/mach/sys_proto.h @@ -16,5 +16,6 @@ extern u32 zynq_slcr_get_idcode(void); extern int zynq_slcr_get_mio_pin_status(const char *periph); extern void zynq_ddrc_init(void); extern unsigned int zynq_get_silicon_version(void); +int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
#endif /* _SYS_PROTO_H_ */

On 6/9/23 11:21, Ashok Reddy Soma wrote:
From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
Add missing prototype to fix the sparse warning, warning: no previous prototype for 'zynqmp_mmio_write' [-Wmissing-prototypes].
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com
arch/arm/mach-zynq/include/mach/sys_proto.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-zynq/include/mach/sys_proto.h b/arch/arm/mach-zynq/include/mach/sys_proto.h index 268ec50ad8..74f9665fbb 100644 --- a/arch/arm/mach-zynq/include/mach/sys_proto.h +++ b/arch/arm/mach-zynq/include/mach/sys_proto.h @@ -16,5 +16,6 @@ extern u32 zynq_slcr_get_idcode(void); extern int zynq_slcr_get_mio_pin_status(const char *periph); extern void zynq_ddrc_init(void); extern unsigned int zynq_get_silicon_version(void); +int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
#endif /* _SYS_PROTO_H_ */
This should be done differently. It should go to include/zynqmp_firmware.h and remove it from platform sys_proto.h file.
Thanks, Michal

From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
Add missing prototype to fix the sparse warning, warning: no previous prototype for 'zynq_qspi_mem_exec_op' [-Wmissing-prototypes].
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com ---
drivers/spi/zynq_qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c index d1d4048966..cb52c0f307 100644 --- a/drivers/spi/zynq_qspi.c +++ b/drivers/spi/zynq_qspi.c @@ -747,8 +747,8 @@ static int zynq_qspi_check_buswidth(struct spi_slave *slave, u8 width) return -EOPNOTSUPP; }
-bool zynq_qspi_mem_exec_op(struct spi_slave *slave, - const struct spi_mem_op *op) +static bool zynq_qspi_mem_exec_op(struct spi_slave *slave, + const struct spi_mem_op *op) { if (zynq_qspi_check_buswidth(slave, op->cmd.buswidth)) return false;

From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
status and ecc_status are of unsigned type where they are compared for negative value. This is pointed by below sparse warning. Change datatype to int to fix this. warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com ---
drivers/mtd/nand/raw/zynq_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c index 9e3ee7412d..545fdd7b69 100644 --- a/drivers/mtd/nand/raw/zynq_nand.c +++ b/drivers/mtd/nand/raw/zynq_nand.c @@ -285,7 +285,7 @@ static int zynq_nand_init_nand_flash(struct mtd_info *mtd, int option) { struct nand_chip *nand_chip = mtd_to_nand(mtd); struct nand_drv *smc = nand_get_controller_data(nand_chip); - u32 status; + int status;
/* disable interrupts */ writel(ZYNQ_NAND_CLR_CONFIG, &smc->reg->cfr); @@ -332,7 +332,7 @@ static int zynq_nand_calculate_hwecc(struct mtd_info *mtd, const u8 *data, struct nand_drv *smc = nand_get_controller_data(nand_chip); u32 ecc_value = 0; u8 ecc_reg, ecc_byte; - u32 ecc_status; + int ecc_status;
/* Wait till the ECC operation is complete */ ecc_status = zynq_nand_waitfor_ecc_completion(mtd);

Hi
On Fri, Jun 9, 2023 at 11:22 AM Ashok Reddy Soma ashok.reddy.soma@amd.com wrote:
From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
status and ecc_status are of unsigned type where they are compared for negative value. This is pointed by below sparse warning. Change datatype to int to fix this. warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com
drivers/mtd/nand/raw/zynq_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c index 9e3ee7412d..545fdd7b69 100644 --- a/drivers/mtd/nand/raw/zynq_nand.c +++ b/drivers/mtd/nand/raw/zynq_nand.c @@ -285,7 +285,7 @@ static int zynq_nand_init_nand_flash(struct mtd_info *mtd, int option) { struct nand_chip *nand_chip = mtd_to_nand(mtd); struct nand_drv *smc = nand_get_controller_data(nand_chip);
u32 status;
int status; /* disable interrupts */ writel(ZYNQ_NAND_CLR_CONFIG, &smc->reg->cfr);
@@ -332,7 +332,7 @@ static int zynq_nand_calculate_hwecc(struct mtd_info *mtd, const u8 *data, struct nand_drv *smc = nand_get_controller_data(nand_chip); u32 ecc_value = 0; u8 ecc_reg, ecc_byte;
u32 ecc_status;
int ecc_status; /* Wait till the ECC operation is complete */ ecc_status = zynq_nand_waitfor_ecc_completion(mtd);
--
Reviewed-By: Michael Trimarchi michael@amarulasolutions.com
2.17.1

From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
Pass missing argument type in the function definition to fix the sparse warning, warning: old-style function definition [-Wold-style-definition]
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com ---
board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c b/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c index 796e5b0c5f..6b153aa379 100644 --- a/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c +++ b/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c @@ -12648,7 +12648,7 @@ unsigned long *ps7_ddr_init_data = ps7_ddr_init_data_3_0; unsigned long *ps7_peripherals_init_data = ps7_peripherals_init_data_3_0;
int -ps7_post_config() +ps7_post_config(void) { // Get the PS_VERSION on run time unsigned long si_ver = ps7GetSiliconVersion (); @@ -12667,7 +12667,7 @@ ps7_post_config() }
int -ps7_init() +ps7_init(void) { // Get the PS_VERSION on run time unsigned long si_ver = ps7GetSiliconVersion ();

On 6/9/23 11:22, Ashok Reddy Soma wrote:
From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
Pass missing argument type in the function definition to fix the sparse warning, warning: old-style function definition [-Wold-style-definition]
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com
board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c | 4 ++--
I see the same thing also
board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c:12430:ps7_init() board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c:12763:ps7_init() board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c:12670:ps7_init() board/xilinx/zynq/zynq-zed/ps7_init_gpl.c:12328:ps7_init()
board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c:12411:ps7_post_config() board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c:12744:ps7_post_config() board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c:12651:ps7_post_config() board/xilinx/zynq/zynq-zed/ps7_init_gpl.c:12309:ps7_post_config()
Thanks, Michal

From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
Add the missing prototypes for the functions pointed by the below sparse warnings warning: no previous prototype for 'set_dfu_alt_info' [-Wmissing-prototypes] warning: no previous prototype for 'board_debug_uart_init' [-Wmissing-prototypes]
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com ---
board/xilinx/zynq/board.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 9a59445b44..3b6581e304 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -5,6 +5,8 @@ */
#include <common.h> +#include <debug_uart.h> +#include <dfu.h> #include <init.h> #include <log.h> #include <dm/uclass.h>

On 6/9/23 11:21, Ashok Reddy Soma wrote:
Fix below sparse warnings
- Add missing prototype for zynqmp_mmio_write
- Add missing prototype for zynq_qspi_mem_exec_op
- Change datatype of status and ecc_status from u32 to int
- Pass the missing argument type in function definition
- Add the missing function prototypes
- Add missing prototype for xilinx_qspi_mem_exec_op
Algapally Santosh Sagar (6): spi: xilinx_spi: Add missing prototype for xilinx_qspi_mem_exec_op xilinx: zynq: Add missing prototype for zynqmp_mmio_write spi: zynq_qspi: Add missing prototype for zynq_qspi_mem_exec_op mtd: nand: zynq_nand: Change datatype of status and ecc_status to int arm: zynq: Pass the missing argument type in function definition xilinx: zynq: Add the missing function prototypes
arch/arm/mach-zynq/include/mach/sys_proto.h | 1 + board/xilinx/zynq/board.c | 2 ++ board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c | 4 ++-- drivers/mtd/nand/raw/zynq_nand.c | 4 ++-- drivers/spi/xilinx_spi.c | 4 ++-- drivers/spi/zynq_qspi.c | 4 ++-- 6 files changed, 11 insertions(+), 8 deletions(-)
The rest looks good to me.
Thanks, Michal
participants (3)
-
Ashok Reddy Soma
-
Michael Nazzareno Trimarchi
-
Michal Simek