]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arm: socfpga: Remove unnecessary for loop
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Mon, 28 Jul 2025 11:25:29 +0000 (12:25 +0100)
committerTien Fong Chee <tien.fong.chee@intel.com>
Wed, 30 Jul 2025 09:45:28 +0000 (17:45 +0800)
The for loop in fpgamgr_program_poll_cd will always terminate after a
single pass and so is not necessary. Remove it and all related code and
leave only the code that is effective.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/fpga/socfpga_gen5.c

index 9473f0573289969162f37e483c47bec908a8fdfa..964a5cc8789e5530b0cdb025cef879227944d9a4 100644 (file)
@@ -119,27 +119,14 @@ static int fpgamgr_program_poll_cd(void)
 {
        const uint32_t mask = FPGAMGRREGS_MON_GPIO_EXT_PORTA_NS_MASK |
                              FPGAMGRREGS_MON_GPIO_EXT_PORTA_CD_MASK;
-       unsigned long reg, i;
+       unsigned long reg;
 
-       /* (3) wait until full config done */
-       for (i = 0; i < FPGA_TIMEOUT_CNT; i++) {
-               reg = readl(&fpgamgr_regs->gpio_ext_porta);
-
-               /* Config error */
-               if (!(reg & mask)) {
-                       printf("FPGA: Configuration error.\n");
-                       return -3;
-               }
-
-               /* Config done without error */
-               if (reg & mask)
-                       break;
-       }
+       reg = readl(&fpgamgr_regs->gpio_ext_porta);
 
-       /* Timeout happened, return error */
-       if (i == FPGA_TIMEOUT_CNT) {
-               printf("FPGA: Timeout waiting for program.\n");
-               return -4;
+       /* Config error */
+       if (!(reg & mask)) {
+               printf("FPGA: Configuration error.\n");
+               return -3;
        }
 
        /* Disable AXI configuration */