• Christophe Leroy's avatar
    module: Fix selfAssignment cppcheck warning · cfa94c53
    Christophe Leroy authored
    cppcheck reports the following warnings:
    
    kernel/module/main.c:1455:26: warning: Redundant assignment of 'mod->core_layout.size' to itself. [selfAssignment]
       mod->core_layout.size = strict_align(mod->core_layout.size);
                             ^
    kernel/module/main.c:1489:26: warning: Redundant assignment of 'mod->init_layout.size' to itself. [selfAssignment]
       mod->init_layout.size = strict_align(mod->init_layout.size);
                             ^
    kernel/module/main.c:1493:26: warning: Redundant assignment of 'mod->init_layout.size' to itself. [selfAssignment]
       mod->init_layout.size = strict_align(mod->init_layout.size);
                             ^
    kernel/module/main.c:1504:26: warning: Redundant assignment of 'mod->init_layout.size' to itself. [selfAssignment]
       mod->init_layout.size = strict_align(mod->init_layout.size);
                             ^
    kernel/module/main.c:1459:26: warning: Redundant assignment of 'mod->data_layout.size' to itself. [selfAssignment]
       mod->data_layout.size = strict_align(mod->data_layout.size);
                             ^
    kernel/module/main.c:1463:26: warning: Redundant assignment of 'mod->data_layout.size' to itself. [selfAssignment]
       mod->data_layout.size = strict_align(mod->data_layout.size);
                             ^
    kernel/module/main.c:1467:26: warning: Redundant assignment of 'mod->data_layout.size' to itself. [selfAssignment]
       mod->data_layout.size = strict_align(mod->data_layout.size);
                             ^
    
    This is due to strict_align() being a no-op when
    CONFIG_STRICT_MODULE_RWX is not selected.
    
    Transform strict_align() macro into an inline function. It will
    allow type checking and avoid the selfAssignment warning.
    Reported-by: default avatarkernel test robot <lkp@intel.com>
    Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
    cfa94c53
internal.h 8.58 KB