forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/net/wireless/ti/wlcore/boot.c
....@@ -1,24 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * This file is part of wl1271
34 *
45 * Copyright (C) 2008-2010 Nokia Corporation
56 *
67 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
7
- *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License
10
- * version 2 as published by the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope that it will be useful, but
13
- * WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20
- * 02110-1301 USA
21
- *
228 */
239
2410 #include <linux/slab.h>
....@@ -86,6 +72,7 @@
8672 unsigned int *min_ver = (wl->fw_type == WL12XX_FW_TYPE_MULTI) ?
8773 wl->min_mr_fw_ver : wl->min_sr_fw_ver;
8874 char min_fw_str[32] = "";
75
+ int off = 0;
8976 int i;
9077
9178 /* the chip must be exactly equal */
....@@ -119,13 +106,15 @@
119106 return 0;
120107
121108 fail:
122
- for (i = 0; i < NUM_FW_VER; i++)
109
+ for (i = 0; i < NUM_FW_VER && off < sizeof(min_fw_str); i++)
123110 if (min_ver[i] == WLCORE_FW_VER_IGNORE)
124
- snprintf(min_fw_str, sizeof(min_fw_str),
125
- "%s*.", min_fw_str);
111
+ off += snprintf(min_fw_str + off,
112
+ sizeof(min_fw_str) - off,
113
+ "*.");
126114 else
127
- snprintf(min_fw_str, sizeof(min_fw_str),
128
- "%s%u.", min_fw_str, min_ver[i]);
115
+ off += snprintf(min_fw_str + off,
116
+ sizeof(min_fw_str) - off,
117
+ "%u.", min_ver[i]);
129118
130119 wl1271_error("Your WiFi FW version (%u.%u.%u.%u.%u) is invalid.\n"
131120 "Please use at least FW %s\n"