Skip to contentSkip to conversation

Fix sparse warnings in zynq platform

PATCH Superseded Ashok Reddy Soma 3 participants 11 messages Jun 9, 2023 – Jun 12, 2023

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/6 spi: xilinx_spi: Add missing prototype for xilinx_qspi_mem_exec_op

From: Algapally Santosh Sagar <[email protected]>

Add missing prototype to fix the below sparse warning
warning: no previous prototype for 'xilinx_qspi_mem_exec_op' [-Wmissing-prototypes]

---

 drivers/spi/xilinx_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/xilinx_spi.c +2 -2
index 33575fe757..b58a3f632a 100644
@@ -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;
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/6 xilinx: zynq: Add missing prototype for zynqmp_mmio_write

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 'zynqmp_mmio_write' [-Wmissing-prototypes].

---

 arch/arm/mach-zynq/include/mach/sys_proto.h | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-zynq/include/mach/sys_proto.h +1 -0
index 268ec50ad8..74f9665fbb 100644
@@ -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_ */
Signature · 1 line
2.17.1
maintainer
#3 lore raw

Re: [PATCH 2/6] xilinx: zynq: Add missing prototype for zynqmp_mmio_write

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 'zynqmp_mmio_write' [-Wmissing-prototypes].

---

  arch/arm/mach-zynq/include/mach/sys_proto.h | 1 +
  1 file changed, 1 insertion(+)
arch/arm/mach-zynq/include/mach/sys_proto.h +0 -0
index 268ec50ad8..74f9665fbb 100644

arch/arm/mach-zynq/include/mach/sys_proto.h extern u32 zynq_slcr_get_idcode(void); · line 21

Quoted 6 lines
arch/arm/mach-zynq/include/mach/sys_proto.h +1 -0
@@ -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

#4 lore raw

PATCH 3/6 spi: zynq_qspi: Add missing prototype for zynq_qspi_mem_exec_op

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 'zynq_qspi_mem_exec_op' [-Wmissing-prototypes].

---

 drivers/spi/zynq_qspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/zynq_qspi.c +2 -2
index d1d4048966..cb52c0f307 100644
@@ -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;
Signature · 1 line
2.17.1
#5 lore raw

PATCH 4/6 mtd: nand: zynq_nand: Change datatype of status and ecc_status to int

In reply to Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

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]

---

 drivers/mtd/nand/raw/zynq_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/zynq_nand.c +2 -2
index 9e3ee7412d..545fdd7b69 100644
@@ -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);
Signature · 1 line
2.17.1
Reviewed-by on v1 4/6
#6 lore raw

Re: [PATCH 4/6] mtd: nand: zynq_nand: Change datatype of status and ecc_status to int

Hi

Quoted 30 lines · Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

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]

---

 drivers/mtd/nand/raw/zynq_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/zynq_nand.c +1 -1
index 9e3ee7412d..545fdd7b69 100644
@@ -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);

drivers/mtd/nand/raw/zynq_nand.c static int zynq_nand_calculate_hwecc(struct mtd_info *mtd, const u8 *data,

Quoted 9 lines
drivers/mtd/nand/raw/zynq_nand.c +1 -2
@@ -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);
--
Quoted 2 lines

2.17.1

#7 lore raw

PATCH 5/6 arm: zynq: Pass the missing argument type in function definition

In reply to Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

Pass missing argument type in the function definition to fix the sparse warning, warning: old-style function definition [-Wold-style-definition]

---

 board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c +2 -2
index 796e5b0c5f..6b153aa379 100644
@@ -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 ();
Signature · 1 line
2.17.1
maintainer
#8 lore raw

Re: [PATCH 5/6] arm: zynq: Pass the missing argument type in function definition

Quoted 11 lines · Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

Pass missing argument type in the function definition to fix the sparse warning, warning: old-style function definition [-Wold-style-definition]

---

  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

#9 lore raw

PATCH 6/6 xilinx: zynq: Add the missing function prototypes

In reply to Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

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]

---

 board/xilinx/zynq/board.c | 2 ++
 1 file changed, 2 insertions(+)
board/xilinx/zynq/board.c +2 -0
index 9a59445b44..3b6581e304 100644
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <debug_uart.h>
+#include <dfu.h>
 #include <init.h>
 #include <log.h>
 #include <dm/uclass.h>
Signature · 1 line
2.17.1
maintainer
#10 lore raw
In reply to Ashok Reddy Soma
Quoted 18 lines · Ashok Reddy Soma

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

Quoted 8 lines
  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