[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210308090320.9765-5-zajec5@gmail.com>
Date: Mon, 8 Mar 2021 10:03:19 +0100
From: Rafał Miłecki <zajec5@...il.com>
To: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc: linux-mips@...r.kernel.org,
Florian Fainelli <f.fainelli@...il.com>,
Vivek Unune <npcomplete13@...il.com>,
bcm-kernel-feedback-list@...adcom.com,
linux-kernel@...r.kernel.org,
Philippe Mathieu-Daudé <f4bug@...at.org>,
Rafał Miłecki <rafal@...ecki.pl>
Subject: [PATCH mips/linux.git 4/5] firmware: bcm47xx_nvram: look for NVRAM with for instead of while
From: Rafał Miłecki <rafal@...ecki.pl>
This loop requires variable initialization, stop condition and post
iteration increment. It's pretty much a for loop definition.
Signed-off-by: Rafał Miłecki <rafal@...ecki.pl>
---
drivers/firmware/broadcom/bcm47xx_nvram.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/firmware/broadcom/bcm47xx_nvram.c b/drivers/firmware/broadcom/bcm47xx_nvram.c
index 09f51b95849e..1d2271b1e07a 100644
--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
+++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
@@ -93,15 +93,13 @@ static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t res_siz
}
/* TODO: when nvram is on nand flash check for bad blocks first. */
- flash_size = FLASH_MIN;
- while (flash_size <= res_size) {
+ for (flash_size = FLASH_MIN; flash_size <= res_size; flash_size <<= 1) {
/* Windowed flash access */
size = find_nvram_size(flash_start + flash_size);
if (size) {
offset = flash_size - size;
goto found;
}
- flash_size <<= 1;
}
/* Try embedded NVRAM at 4 KB and 1 KB as last resorts */
--
2.26.2
Powered by blists - more mailing lists