Skip to content

Commit 00759c0

Browse files
rddunlapmichal42
authored andcommitted
modpost: fix trailing comma
Consolidate locations that print a section whitelist into calls to print_section_list(). Fix print_section_list() so that it does not print a trailing comma & space: If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console, becomes: If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent e1b702c commit 00759c0

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

‎scripts/mod/modpost.c‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,19 @@ static int is_function(Elf_Sym *sym)
12481248
return -1;
12491249
}
12501250

1251+
static void print_section_list(const char * const list[20])
1252+
{
1253+
const char *const *s = list;
1254+
1255+
while (*s) {
1256+
fprintf(stderr, "%s", *s);
1257+
s++;
1258+
if (*s)
1259+
fprintf(stderr, ", ");
1260+
}
1261+
fprintf(stderr, "\n");
1262+
}
1263+
12511264
/*
12521265
* Print a warning about a section mismatch.
12531266
* Try to find symbols near it so user can find it.
@@ -1304,17 +1317,14 @@ static void report_sec_mismatch(const char *modname,
13041317
break;
13051318
case DATA_TO_ANY_INIT: {
13061319
prl_to = sec2annotation(tosec);
1307-
const char *const *s = mismatch->symbol_white_list;
13081320
fprintf(stderr,
13091321
"The variable %s references\n"
13101322
"the %s %s%s%s\n"
13111323
"If the reference is valid then annotate the\n"
13121324
"variable with __init* or __refdata (see linux/init.h) "
13131325
"or name the variable:\n",
13141326
fromsym, to, prl_to, tosym, to_p);
1315-
while (*s)
1316-
fprintf(stderr, "%s, ", *s++);
1317-
fprintf(stderr, "\n");
1327+
print_section_list(mismatch->symbol_white_list);
13181328
free(prl_to);
13191329
break;
13201330
}
@@ -1329,17 +1339,14 @@ static void report_sec_mismatch(const char *modname,
13291339
break;
13301340
case DATA_TO_ANY_EXIT: {
13311341
prl_to = sec2annotation(tosec);
1332-
const char *const *s = mismatch->symbol_white_list;
13331342
fprintf(stderr,
13341343
"The variable %s references\n"
13351344
"the %s %s%s%s\n"
13361345
"If the reference is valid then annotate the\n"
13371346
"variable with __exit* (see linux/init.h) or "
13381347
"name the variable:\n",
13391348
fromsym, to, prl_to, tosym, to_p);
1340-
while (*s)
1341-
fprintf(stderr, "%s, ", *s++);
1342-
fprintf(stderr, "\n");
1349+
print_section_list(mismatch->symbol_white_list);
13431350
free(prl_to);
13441351
break;
13451352
}

0 commit comments

Comments
 (0)