9c38b485f57cda45a4b1f3f328083ec3ad2f3884
[openwrt/staging/ynezz.git] /
1 From 43be5f0f6c36e23d6f51c1f1f55ebcec920cc453 Mon Sep 17 00:00:00 2001
2 From: Jason Liu <jason.hui.liu@nxp.com>
3 Date: Thu, 2 Jan 2020 12:46:37 +0800
4 Subject: [PATCH] LF-697 net: ethernet: freescale: sdk_fman: fix the build
5 warnings
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 The patch fixes the build warnings by adding the comments 'fall through' to avoid the build warnings
11 The patch also initializes the value pgid_val to avoid the warning: ‘pgid_val’ may be used uninitialized
12 The patch should not and will not have any function impact.
13
14 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.c: In function ‘ValidateNextEngineParams’:
15 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.c:1681:51: warning: this statement may fall through [-Wimplicit-fallthrough=]
16 In file included from drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c:40:
17 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c: In function ‘GetGenHdrCode’:
18 drivers/net/ethernet/freescale/sdk_fman/inc/error_ext.h:446:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
19 In file included from drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c:40:
20 drivers/net/ethernet/freescale/sdk_fman/inc/error_ext.h:446:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
21 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c:255:13: note: here
22 255 | case (HEADER_TYPE_ETH):
23 | ^~~~
24 In file included from drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c:40:
25 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c:278:13: note: here
26 278 | case (HEADER_TYPE_MINENCAP):
27 | ^~~~
28 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.c: In function ‘BuildHmct’:
29 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.c:673:32: warning: this statement may fall through [-Wimplicit-fallthrough=]
30 673 | tmpReg = HMCD_INSRT_UDP_LITE;
31 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.c:674:21: note: here
32 674 | case (e_FM_PCD_MANIP_INSRT_BY_HDR_UDP):
33 | ^~~~
34 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c: In function ‘FM_PORT_Config’:
35 arch/arm64/include/asm/io.h:36:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
36 36 | #define __raw_writel __raw_writel
37 drivers/net/ethernet/freescale/sdk_fman/src/inc/types_linux.h:99:25: note: in expansion of macro ‘__raw_writel’
38 99 | #define out_be32(a, v) __raw_writel(__cpu_to_be32(v), a)
39 | ^~~~~~~~~~~~
40 drivers/net/ethernet/freescale/sdk_fman/src/inc/types_linux.h:121:37: note: in expansion of macro ‘out_be32’
41 121 | #define WRITE_UINT32(arg, data) out_be32(&(arg), data)//*(volatile unsigned int *)(&(arg)) = (data)
42 | ^~~~~~~~
43 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:2404:13: note: in expansion of macro ‘WRITE_UINT32’
44 2404 | WRITE_UINT32( p_FmPort->p_FmPortBmiRegs->txPortBmiRegs.fmbm_tfp,
45 | ^~~~~~~~~~~~
46 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:2407:9: note: here
47 2407 | case (e_FM_PORT_TYPE_TX_10G):
48 | ^~~~
49 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:2435:60: warning: this statement may fall through [-Wimplicit-fallthrough=]
50 2435 | p_FmPort->p_FmPortDriverParam->noScatherGather =
51 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:2438:9: note: here
52 2438 | case (e_FM_PORT_TYPE_OH_HOST_COMMAND):
53 | ^~~~
54 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c: In function ‘FM_PORT_ModifyCounter’:
55 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:4268:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
56 4268 | if ((p_FmPort->portType == e_FM_PORT_TYPE_RX)
57 | ^
58 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:4273:9: note: here
59 4273 | case (e_FM_PORT_COUNTERS_ENQ_TOTAL):
60 | ^~~~
61 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c: In function ‘SetPcd’:
62 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:1396:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
63 1396 | tmpReg = NIA_KG_CC_EN;
64 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:1397:13: note: here
65 1397 | case (e_FM_PORT_PCD_SUPPORT_PRS_AND_KG):
66 | ^~~~
67 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.c: In function ‘FM_GetCounter’:
68 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.c:4804:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
69 4804 | if ((p_Fm->p_FmStateStruct->revInfo.majorRev == 4) ||
70 | ^
71 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.c:4810:9: note: here
72 4810 | case (e_FM_COUNTERS_ENQ_TOTAL_FRAME):
73 | ^~~~
74 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c: In function ‘fm_get_counter’:
75 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c:1803:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
76 1803 | if (p_fm->p_FmStateStruct->revInfo.majorRev >= 6)
77 | ^
78 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c:1806:2: note: here
79 1806 | case (e_FM_COUNTERS_ENQ_TOTAL_FRAME):
80 | ^~~~
81 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c: In function ‘compat_copy_fm_pcd_cc_next_engine’:
82 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c:378:33: warning: this statement may fall through [-Wimplicit-fallthrough=]
83 378 | param->manip_id = compat_pcd_id2ptr(compat_param->manip_id);
84 | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c:379:13: note: here
86 379 | default:
87 | ^~~~~~~
88 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c:405:40: warning: this statement may fall through [-Wimplicit-fallthrough=]
89 405 | compat_param->manip_id = compat_pcd_ptr2id(param->manip_id);
90 | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c:406:13: note: here
92 406 | default:
93 | ^~~~~~~
94 In file included from drivers/net/ethernet/mscc/ocelot.h:21,
95 from drivers/net/ethernet/mscc/ocelot_tsn.c:12:
96 drivers/net/ethernet/mscc/ocelot_tsn.c: In function ‘ocelot_seq_gen_set’:
97 include/soc/mscc/ocelot.h:499:48: warning: ‘pgid_val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
98 499 | #define ocelot_write_rix(ocelot, val, reg, ri) __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
99 | ^~~~~~~~~~~~~~~~~
100 drivers/net/ethernet/mscc/ocelot_tsn.c:755:5: note: ‘pgid_val’ was declared here
101 755 | u8 pgid_val, fwdport;
102
103 Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
104 Cc: Madalin Bucur <madalin.bucur@nxp.com>
105 Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
106 ---
107 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.c | 1 +
108 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c | 4 ++++
109 .../net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.c | 1 +
110 .../net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c | 5 +++++
111 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.c | 3 +++
112 .../freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c | 2 ++
113 .../net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c | 3 +++
114 drivers/net/ethernet/mscc/ocelot_tsn.c | 2 +-
115 8 files changed, 20 insertions(+), 1 deletion(-)
116
117 --- a/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.c
118 +++ b/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.c
119 @@ -1679,6 +1679,7 @@ t_Error ValidateNextEngineParams(
120
121 case (e_FM_PCD_HASH):
122 p_FmPcdCcNextEngineParams->nextEngine = e_FM_PCD_CC;
123 + /* fall through */
124 case (e_FM_PCD_CC):
125 if (!p_FmPcdCcNextEngineParams->params.ccParams.h_CcNode)
126 RETURN_ERROR(MAJOR, E_NULL_POINTER,
127 --- a/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c
128 +++ b/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c
129 @@ -198,6 +198,7 @@ static uint8_t GetGenHdrCode(e_NetHeader
130 {
131 case (HEADER_TYPE_NONE):
132 ASSERT_COND(FALSE);
133 + /* Else fall through */
134 case (HEADER_TYPE_ETH):
135 return KG_SCH_GEN_ETH;
136 case (HEADER_TYPE_LLC_SNAP):
137 @@ -252,6 +253,7 @@ static uint8_t GetGenHdrCode(e_NetHeader
138 {
139 case (HEADER_TYPE_NONE):
140 ASSERT_COND(FALSE);
141 + /* Else fall through */
142 case (HEADER_TYPE_ETH):
143 return KG_SCH_GEN_ETH_NO_V;
144 case (HEADER_TYPE_LLC_SNAP):
145 @@ -269,12 +271,14 @@ static uint8_t GetGenHdrCode(e_NetHeader
146 REPORT_ERROR(MAJOR, E_NOT_SUPPORTED, ("Illegal MPLS header index"));
147 return 0;
148 case (HEADER_TYPE_IPv4):
149 + /* fall through */
150 case (HEADER_TYPE_IPv6):
151 if ((hdrIndex == e_FM_PCD_HDR_INDEX_NONE) || (hdrIndex == e_FM_PCD_HDR_INDEX_1))
152 return KG_SCH_GEN_L3_NO_V;
153 if ((hdrIndex == e_FM_PCD_HDR_INDEX_2) || (hdrIndex == e_FM_PCD_HDR_INDEX_LAST))
154 return KG_SCH_GEN_IP2_NO_V;
155 REPORT_ERROR(MAJOR, E_NOT_SUPPORTED, ("Illegal IP header index"));
156 + /* fall through */
157 case (HEADER_TYPE_MINENCAP):
158 return KG_SCH_GEN_IP2_NO_V;
159 case (HEADER_TYPE_USER_DEFINED_L3):
160 --- a/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.c
161 +++ b/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.c
162 @@ -671,6 +671,7 @@ static t_Error BuildHmct(t_FmPcdManip *p
163 break;
164 case (e_FM_PCD_MANIP_INSRT_BY_HDR_UDP_LITE):
165 tmpReg = HMCD_INSRT_UDP_LITE;
166 + /* fall through */
167 case (e_FM_PCD_MANIP_INSRT_BY_HDR_UDP):
168 tmpReg |= (uint32_t)(HMCD_OPCODE_UDP_INSRT)
169 << HMCD_OC_SHIFT;
170 --- a/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c
171 +++ b/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c
172 @@ -1394,6 +1394,7 @@ static t_Error SetPcd(t_FmPort *p_FmPort
173 case (e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_CC):
174 case (e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_CC_AND_PLCR):
175 tmpReg = NIA_KG_CC_EN;
176 + /* fall through */
177 case (e_FM_PORT_PCD_SUPPORT_PRS_AND_KG):
178 case (e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_PLCR):
179 if (p_PcdParams->p_KgParams->directScheme)
180 @@ -2404,6 +2405,8 @@ t_Handle FM_PORT_Config(t_FmPortParams *
181 WRITE_UINT32( p_FmPort->p_FmPortBmiRegs->txPortBmiRegs.fmbm_tfp,
182 tmpReg);
183 #endif /* FM_WRONG_RESET_VALUES_ERRATA_FMAN_A005127 */
184 +
185 + /* fall through */
186 case (e_FM_PORT_TYPE_TX_10G):
187 tmpReg =
188 GET_UINT32(p_FmPort->p_FmPortBmiRegs->txPortBmiRegs.fmbm_tfp);
189 @@ -2435,6 +2438,7 @@ t_Handle FM_PORT_Config(t_FmPortParams *
190 p_FmPort->p_FmPortDriverParam->noScatherGather =
191 DEFAULT_PORT_noScatherGather;
192 #endif /* (DPAA_VERSION >= 11) */
193 + /* fall through */
194 case (e_FM_PORT_TYPE_OH_HOST_COMMAND):
195 p_FmPort->p_FmPortDriverParam->deqPrefetchOption =
196 DEFAULT_PORT_deqPrefetchOption_HC;
197 @@ -4270,6 +4274,7 @@ t_Error FM_PORT_ModifyCounter(t_Handle h
198 RETURN_ERROR(
199 MINOR, E_INVALID_STATE,
200 ("Requested counter is not available for Rx ports"));
201 + /* fall through */
202 case (e_FM_PORT_COUNTERS_ENQ_TOTAL):
203 bmiCounter = FALSE;
204 break;
205 --- a/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.c
206 +++ b/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.c
207 @@ -4800,6 +4800,7 @@ uint32_t FM_GetCounter(t_Handle h_Fm, e_
208 {
209 case (e_FM_COUNTERS_DEQ_1):
210 case (e_FM_COUNTERS_DEQ_2):
211 + /* fall through */
212 case (e_FM_COUNTERS_DEQ_3):
213 if ((p_Fm->p_FmStateStruct->revInfo.majorRev == 4) ||
214 (p_Fm->p_FmStateStruct->revInfo.majorRev >= 6))
215 @@ -4807,12 +4808,14 @@ uint32_t FM_GetCounter(t_Handle h_Fm, e_
216 REPORT_ERROR(MAJOR, E_NOT_SUPPORTED, ("Requested counter not supported"));
217 return 0;
218 }
219 + /* fall through */
220 case (e_FM_COUNTERS_ENQ_TOTAL_FRAME):
221 case (e_FM_COUNTERS_DEQ_TOTAL_FRAME):
222 case (e_FM_COUNTERS_DEQ_0):
223 case (e_FM_COUNTERS_DEQ_FROM_DEFAULT):
224 case (e_FM_COUNTERS_DEQ_FROM_CONTEXT):
225 case (e_FM_COUNTERS_DEQ_FROM_FD):
226 + /* fall through */
227 case (e_FM_COUNTERS_DEQ_CONFIRM):
228 if (!(GET_UINT32(p_Fm->p_FmQmiRegs->fmqm_gc) & QMI_CFG_EN_COUNTERS))
229 {
230 --- a/drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c
231 +++ b/drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c
232 @@ -376,6 +376,7 @@ static inline void compat_copy_fm_pcd_cc
233 case e_IOC_FM_PCD_DONE:
234 case e_IOC_FM_PCD_PLCR:
235 param->manip_id = compat_pcd_id2ptr(compat_param->manip_id);
236 + /* fall through */
237 default:
238 memcpy(&param->params, &compat_param->params, sizeof(param->params));
239 }
240 @@ -403,6 +404,7 @@ static inline void compat_copy_fm_pcd_cc
241 case e_IOC_FM_PCD_DONE:
242 case e_IOC_FM_PCD_PLCR:
243 compat_param->manip_id = compat_pcd_ptr2id(param->manip_id);
244 + /* fall through */
245 default:
246 memcpy(&compat_param->params, &param->params, sizeof(compat_param->params));
247 }
248 --- a/drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c
249 +++ b/drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c
250 @@ -1799,16 +1799,19 @@ int fm_get_counter(void *h_fm, e_FmCount
251 switch (cnt_e) {
252 case (e_FM_COUNTERS_DEQ_1):
253 case (e_FM_COUNTERS_DEQ_2):
254 + /* fall through */
255 case (e_FM_COUNTERS_DEQ_3):
256 if (p_fm->p_FmStateStruct->revInfo.majorRev >= 6)
257 return -EINVAL; /* counter not available */
258
259 + /* Else fall through */
260 case (e_FM_COUNTERS_ENQ_TOTAL_FRAME):
261 case (e_FM_COUNTERS_DEQ_TOTAL_FRAME):
262 case (e_FM_COUNTERS_DEQ_0):
263 case (e_FM_COUNTERS_DEQ_FROM_DEFAULT):
264 case (e_FM_COUNTERS_DEQ_FROM_CONTEXT):
265 case (e_FM_COUNTERS_DEQ_FROM_FD):
266 + /* fall through */
267 case (e_FM_COUNTERS_DEQ_CONFIRM):
268 if (!(ioread32be(&p_fm->p_FmQmiRegs->fmqm_gc) &
269 QMI_CFG_EN_COUNTERS))
270 --- a/drivers/net/ethernet/mscc/ocelot_tsn.c
271 +++ b/drivers/net/ethernet/mscc/ocelot_tsn.c
272 @@ -752,7 +752,7 @@ static int streamid_multi_forward_set(st
273 u32 bucket;
274 u32 val;
275 int m, n, i;
276 - u8 pgid_val, fwdport;
277 + u8 pgid_val = 0, fwdport;
278 u32 dst_idx;
279
280 m_index = index / 4;