Skip to content

Commit c4f3f69

Browse files
committed
fixup: CI cpp_check
1 parent e310030 commit c4f3f69

File tree

3 files changed

+64
-38
lines changed

3 files changed

+64
-38
lines changed

Diff for: components/drivers/ofw/base.c

+40-31
Original file line numberDiff line numberDiff line change
@@ -1109,17 +1109,20 @@ struct rt_ofw_node *rt_ofw_get_alias_node(const char *tag, int id)
11091109

11101110
if (tag && id >= 0)
11111111
{
1112-
rt_list_for_each_entry(info, &_aliases_nodes, list)
1112+
if (!rt_list_isempty(&_aliases_nodes))
11131113
{
1114-
if (rt_strncmp(info->tag, tag, info->tag_len))
1114+
rt_list_for_each_entry(info, &_aliases_nodes, list)
11151115
{
1116-
continue;
1117-
}
1116+
if (rt_strncmp(info->tag, tag, info->tag_len))
1117+
{
1118+
continue;
1119+
}
11181120

1119-
if (info->id == id)
1120-
{
1121-
np = info->np;
1122-
break;
1121+
if (info->id == id)
1122+
{
1123+
np = info->np;
1124+
break;
1125+
}
11231126
}
11241127
}
11251128
}
@@ -1130,18 +1133,20 @@ struct rt_ofw_node *rt_ofw_get_alias_node(const char *tag, int id)
11301133
int ofw_alias_node_id(struct rt_ofw_node *np)
11311134
{
11321135
int id;
1133-
struct alias_info *info;
1136+
struct alias_info *info = RT_NULL;
11341137

11351138
if (np)
11361139
{
11371140
id = -1;
1138-
1139-
rt_list_for_each_entry(info, &_aliases_nodes, list)
1141+
if (!rt_list_isempty(&_aliases_nodes))
11401142
{
1141-
if (info->np == np)
1143+
rt_list_for_each_entry(info, &_aliases_nodes, list)
11421144
{
1143-
id = info->id;
1144-
break;
1145+
if (info->np == np)
1146+
{
1147+
id = info->id;
1148+
break;
1149+
}
11451150
}
11461151
}
11471152
}
@@ -1161,18 +1166,20 @@ int rt_ofw_get_alias_id(struct rt_ofw_node *np, const char *tag)
11611166
if (np && tag)
11621167
{
11631168
id = -1;
1164-
1165-
rt_list_for_each_entry(info, &_aliases_nodes, list)
1169+
if (!rt_list_isempty(&_aliases_nodes))
11661170
{
1167-
if (rt_strncmp(info->tag, tag, info->tag_len))
1171+
rt_list_for_each_entry(info, &_aliases_nodes, list)
11681172
{
1169-
continue;
1170-
}
1173+
if (rt_strncmp(info->tag, tag, info->tag_len))
1174+
{
1175+
continue;
1176+
}
11711177

1172-
if (info->np == np)
1173-
{
1174-
id = info->id;
1175-
break;
1178+
if (info->np == np)
1179+
{
1180+
id = info->id;
1181+
break;
1182+
}
11761183
}
11771184
}
11781185
}
@@ -1192,17 +1199,19 @@ int rt_ofw_get_alias_last_id(const char *tag)
11921199
if (tag)
11931200
{
11941201
id = -1;
1195-
1196-
rt_list_for_each_entry(info, &_aliases_nodes, list)
1202+
if (!rt_list_isempty(&_aliases_nodes))
11971203
{
1198-
if (rt_strncmp(info->tag, tag, info->tag_len))
1204+
rt_list_for_each_entry(info, &_aliases_nodes, list)
11991205
{
1200-
continue;
1201-
}
1206+
if (rt_strncmp(info->tag, tag, info->tag_len))
1207+
{
1208+
continue;
1209+
}
12021210

1203-
if (info->id > id)
1204-
{
1205-
id = info->id;
1211+
if (info->id > id)
1212+
{
1213+
id = info->id;
1214+
}
12061215
}
12071216
}
12081217
}

Diff for: libcpu/aarch64/common/interrupt.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,17 @@ void rt_hw_interrupt_mask(int vector)
139139
#ifdef SOC_BCM283x
140140
if (vector < 32)
141141
{
142-
IRQ_DISABLE1 = (1 << vector);
142+
IRQ_DISABLE1 = (1L << vector);
143143
}
144144
else if (vector < 64)
145145
{
146146
vector = vector % 32;
147-
IRQ_DISABLE2 = (1 << vector);
147+
IRQ_DISABLE2 = (1L << vector);
148148
}
149149
else
150150
{
151151
vector = vector - 64;
152-
IRQ_DISABLE_BASIC = (1 << vector);
152+
IRQ_DISABLE_BASIC = (1L << vector);
153153
}
154154
#else
155155
arm_gic_mask(0, vector);
@@ -165,17 +165,17 @@ void rt_hw_interrupt_umask(int vector)
165165
#ifdef SOC_BCM283x
166166
if (vector < 32)
167167
{
168-
IRQ_ENABLE1 = (1 << vector);
168+
IRQ_ENABLE1 = (1L << vector);
169169
}
170170
else if (vector < 64)
171171
{
172172
vector = vector % 32;
173-
IRQ_ENABLE2 = (1 << vector);
173+
IRQ_ENABLE2 = (1L << vector);
174174
}
175175
else
176176
{
177177
vector = vector - 64;
178-
IRQ_ENABLE_BASIC = (1 << vector);
178+
IRQ_ENABLE_BASIC = (1L << vector);
179179
}
180180
#else
181181
arm_gic_umask(0, vector);

Diff for: tools/ci/cpp_check.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,24 @@ def check(self):
2323
logging.info("Start to static code analysis.")
2424
check_result = True
2525
for file in file_list_filtered:
26-
result = subprocess.run(['cppcheck', '-DRTM_EXPORT', '-DMSH_CMD_EXPORT(a,b)=', '--enable=warning', 'performance', 'portability', '--inline-suppr', '--error-exitcode=1', '--force', file], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
26+
result = subprocess.run(
27+
[
28+
'cppcheck',
29+
'-DRT_ASSERT(x)=',
30+
'-Drt_list_for_each_entry(a,b,c)=a=(void*)b;',
31+
'-I include',
32+
'-I thread/components/finsh',
33+
# it's okay because CI will do the real compilation to check this
34+
'--suppress=syntaxError',
35+
'--enable=warning',
36+
'performance',
37+
'portability',
38+
'--inline-suppr',
39+
'--error-exitcode=1',
40+
'--force',
41+
file
42+
],
43+
stdout = subprocess.PIPE, stderr = subprocess.PIPE)
2744
logging.info(result.stdout.decode())
2845
logging.info(result.stderr.decode())
2946
if result.stderr:

0 commit comments

Comments
 (0)