Skip to content

Commit

Permalink
modpost: fix trailing comma
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Randy Dunlap authored and Michal Marek committed Mar 17, 2011
1 parent e1b702c commit 00759c0
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,19 @@ static int is_function(Elf_Sym *sym)
return -1;
}

static void print_section_list(const char * const list[20])
{
const char *const *s = list;

while (*s) {
fprintf(stderr, "%s", *s);
s++;
if (*s)
fprintf(stderr, ", ");
}
fprintf(stderr, "\n");
}

/*
* Print a warning about a section mismatch.
* Try to find symbols near it so user can find it.
Expand Down Expand Up @@ -1304,17 +1317,14 @@ static void report_sec_mismatch(const char *modname,
break;
case DATA_TO_ANY_INIT: {
prl_to = sec2annotation(tosec);
const char *const *s = mismatch->symbol_white_list;
fprintf(stderr,
"The variable %s references\n"
"the %s %s%s%s\n"
"If the reference is valid then annotate the\n"
"variable with __init* or __refdata (see linux/init.h) "
"or name the variable:\n",
fromsym, to, prl_to, tosym, to_p);
while (*s)
fprintf(stderr, "%s, ", *s++);
fprintf(stderr, "\n");
print_section_list(mismatch->symbol_white_list);
free(prl_to);
break;
}
Expand All @@ -1329,17 +1339,14 @@ static void report_sec_mismatch(const char *modname,
break;
case DATA_TO_ANY_EXIT: {
prl_to = sec2annotation(tosec);
const char *const *s = mismatch->symbol_white_list;
fprintf(stderr,
"The variable %s references\n"
"the %s %s%s%s\n"
"If the reference is valid then annotate the\n"
"variable with __exit* (see linux/init.h) or "
"name the variable:\n",
fromsym, to, prl_to, tosym, to_p);
while (*s)
fprintf(stderr, "%s, ", *s++);
fprintf(stderr, "\n");
print_section_list(mismatch->symbol_white_list);
free(prl_to);
break;
}
Expand Down

0 comments on commit 00759c0

Please sign in to comment.