0dadc601a92ed9e9e3b7306b57b0db10fd5a4538
[openwrt/staging/dangole.git] /
1 From 98b68324f67236e8c9152976535dc1f27fb67ba8 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Mon, 8 Mar 2021 10:03:19 +0100
4 Subject: [PATCH] firmware: bcm47xx_nvram: look for NVRAM with for instead of
5 while
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 This loop requires variable initialization, stop condition and post
11 iteration increment. It's pretty much a for loop definition.
12
13 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
14 Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
15 ---
16 drivers/firmware/broadcom/bcm47xx_nvram.c | 4 +---
17 1 file changed, 1 insertion(+), 3 deletions(-)
18
19 diff --git a/drivers/firmware/broadcom/bcm47xx_nvram.c b/drivers/firmware/broadcom/bcm47xx_nvram.c
20 index 09f51b95849e..1d2271b1e07a 100644
21 --- a/drivers/firmware/broadcom/bcm47xx_nvram.c
22 +++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
23 @@ -93,15 +93,13 @@ static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t res_siz
24 }
25
26 /* TODO: when nvram is on nand flash check for bad blocks first. */
27 - flash_size = FLASH_MIN;
28 - while (flash_size <= res_size) {
29 + for (flash_size = FLASH_MIN; flash_size <= res_size; flash_size <<= 1) {
30 /* Windowed flash access */
31 size = find_nvram_size(flash_start + flash_size);
32 if (size) {
33 offset = flash_size - size;
34 goto found;
35 }
36 - flash_size <<= 1;
37 }
38
39 /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */
40 --
41 2.26.2
42