]> git.baikalelectronics.ru Git - kernel.git/commit
modpost: squash if...else-if in find_elf_symbol2()
authorMasahiro Yamada <masahiroy@kernel.org>
Mon, 23 May 2022 16:46:26 +0000 (01:46 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Fri, 27 May 2022 07:16:35 +0000 (16:16 +0900)
commit5c71c567b484ce29aaf92d6fe9ff29013159fd0e
treed09b49103160016cd35072202924f9c8132f3693
parent548ff74687fbe09a5fee44f143ab2f17b3dbb07f
modpost: squash if...else-if in find_elf_symbol2()

if ((addr - sym->st_value) < distance) {
            distance = addr - sym->st_value;
            near = sym;
    } else if ((addr - sym->st_value) == distance) {
            near = sym;
    }

is equivalent to:

    if (addr - sym->st_value <= distance) {
            distance = addr - sym->st_value;
            near = sym;
    }

(The else-if block can overwrite 'distance' with the same value).

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
scripts/mod/modpost.c