Skip to content

Commit 4a09047

Browse files
drivers: bluetooth: hci_nxp_setup: Prevent re-init of CRC table.
The CRC32 table only needs to be generated once, so prevent it from regenerating every time as it only required once. Signed-off-by: Bas van Loon <[email protected]>
1 parent 6c569c5 commit 4a09047

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/bluetooth/hci/hci_nxp_setup.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ static void fw_upload_gen_crc32_table(void)
7777
int i, j;
7878
unsigned long crc_accum;
7979

80+
if (made_table) {
81+
return;
82+
}
83+
8084
for (i = 0; i < 256; i++) {
8185
crc_accum = ((unsigned long)i << 24);
8286
for (j = 0; j < 8; j++) {
@@ -88,6 +92,9 @@ static void fw_upload_gen_crc32_table(void)
8892
}
8993
crc_table[i] = crc_accum;
9094
}
95+
96+
/* Mark CRC32 table generation complete */
97+
made_table = true;
9198
}
9299

93100
static unsigned char fw_upload_crc8(unsigned char *array, unsigned char len)

0 commit comments

Comments
 (0)