blob: 6cf6faeddd1478168d71781f4d9290d4f8ad5de0 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001--- a/driver/nvram_stub.c
2+++ b/driver/nvram_stub.c
3@@ -22,6 +22,7 @@ typedef struct _vars {
4 #define VARS_T_OH sizeof(vars_t)
5
6 static vars_t *vars = NULL;
7+static int nvram_init_done = 0;
8 extern char *nvram_buf[];
9
10 int
11@@ -33,6 +34,10 @@ BCMATTACHFN(nvram_init)(void *si)
12 uint nvs, bufsz;
13 vars_t *new;
14
15+ nvram_init_done++;
16+ if (nvram_init_done != 1)
17+ return 0;
18+
19 osh = si_osh(sih);
20
21 nvs = R_REG(osh, &nvh->len) - sizeof(struct nvram_header);
22@@ -79,6 +84,10 @@ BCMATTACHFN(nvram_exit)(void *si)
23 vars_t *this, *next;
24 si_t *sih;
25
26+ nvram_init_done--;
27+ if (nvram_init_done != 0)
28+ return;
29+
30 sih = (si_t *)si;
31 this = vars;
32 while (this) {