genksyms: reduce indentation in export_symbol()

Modify this function to return earlier when find_symbol() returns NULL,
reducing the level of improve readability.

No functional changes are intended.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
Masahiro Yamada 2024-11-22 08:22:55 +09:00
parent 2b1bd50754
commit 091aa11a29

View File

@ -632,14 +632,15 @@ static unsigned long expand_and_crc_sym(struct symbol *sym, unsigned long crc)
void export_symbol(const char *name)
{
struct symbol *sym;
sym = find_symbol(name, SYM_NORMAL, 0);
if (!sym)
error_with_pos("export undefined symbol %s", name);
else {
unsigned long crc;
int has_changed = 0;
sym = find_symbol(name, SYM_NORMAL, 0);
if (!sym) {
error_with_pos("export undefined symbol %s", name);
return;
}
if (flag_dump_defs)
fprintf(debugfile, "Export %s == <", name);
@ -656,12 +657,13 @@ void export_symbol(const char *name)
if (sym->status != STATUS_UNCHANGED) {
if (!has_changed) {
print_location();
fprintf(stderr, "%s: %s: modversion "
"changed because of changes "
"in ", flag_preserve ? "error" :
"warning", name);
} else
fprintf(stderr,
"%s: %s: modversion changed because of changes in ",
flag_preserve ? "error" : "warning",
name);
} else {
fprintf(stderr, ", ");
}
print_type_name(sym->type, sym->name);
if (sym->status == STATUS_DEFINED)
fprintf(stderr, " (became defined)");
@ -680,7 +682,6 @@ void export_symbol(const char *name)
printf("#SYMVER %s 0x%08lx\n", name, crc);
}
}
/*----------------------------------------------------------------------*/