diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 70d211d0b99..78b70d8af60 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -2213,13 +2213,14 @@ int main(int argc, char **argv) "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", sec_mismatch_count); - if (section_error_on_mismatch) { - err |= 1; - printf( - "To build the kernel despite the mismatches, " - "build with:\n'make CONFIG_NO_ERROR_ON_MISMATCH=y'\n" - "(NOTE: This is not recommended)\n"); - } + } + + if (sec_mismatch_count && section_error_on_mismatch) { + err |= 1; + printf( + "To build the kernel despite the mismatches, " + "build with:\n'make CONFIG_NO_ERROR_ON_MISMATCH=y'\n" + "(NOTE: This is not recommended)\n"); } return err;