diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp index 061fa5d093..c661a9dd77 100644 --- a/Kernel/CommandLine.cpp +++ b/Kernel/CommandLine.cpp @@ -46,7 +46,7 @@ UNMAP_AFTER_INIT void CommandLine::build_commandline(const String& cmdline_from_ { StringBuilder builder; builder.append(cmdline_from_bootloader); - if (!s_embedded_cmd_line.is_empty()) { + if constexpr (!s_embedded_cmd_line.is_empty()) { builder.append(" "); builder.append(s_embedded_cmd_line); } diff --git a/Kernel/KSyms.cpp b/Kernel/KSyms.cpp index c38994a347..cbd098071d 100644 --- a/Kernel/KSyms.cpp +++ b/Kernel/KSyms.cpp @@ -111,10 +111,8 @@ NEVER_INLINE static void dump_backtrace_impl(FlatPtr base_pointer, bool use_ksym } while (0) SmapDisabler disabler; - if (use_ksyms && !g_kernel_symbols_available) { + if (use_ksyms && !g_kernel_symbols_available) Processor::halt(); - return; - } struct RecognizedSymbol { FlatPtr address; diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index 74dd109598..fd6895237c 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -413,7 +413,7 @@ KResult LocalSocket::getsockopt(OpenFileDescription& description, int level, int default: return EINVAL; } - break; + VERIFY_NOT_REACHED(); } default: return Socket::getsockopt(description, level, option, value, value_size); diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index 5450bf30e0..e49f6f530a 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -531,8 +531,8 @@ void handle_tcp(IPv4Packet const& ipv4_packet, Time const& packet_timestamp) socket->set_state(TCPSocket::State::Closed); return; } + VERIFY_NOT_REACHED(); - return; case TCPFlags::SYN: dbgln("handle_tcp: ignoring SYN for partially established connection"); return; diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 5cdce4c217..449ddc3828 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -592,8 +592,8 @@ bool Process::dump_perfcore() } auto json_buffer = UserOrKernelBuffer::for_kernel_buffer(json->data()); if (description.write(json_buffer, json->size()).is_error()) { - return false; dbgln("Failed to generate perfcore for pid {}: Could not write to perfcore file.", pid().value()); + return false; } dbgln("Wrote perfcore for pid {} to {}", pid().value(), description.absolute_path()); diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp index d4ca07b2ce..c8eb76ba60 100644 --- a/Kernel/Syscall.cpp +++ b/Kernel/Syscall.cpp @@ -141,10 +141,8 @@ KResultOr handle(RegisterState& regs, FlatPtr function, FlatPtr arg1, F switch (function) { case SC_exit: process.sys$exit(arg1); - break; case SC_exit_thread: process.sys$exit_thread(arg1, arg2, arg3); - break; default: VERIFY_NOT_REACHED(); } diff --git a/Kernel/Syscalls/prctl.cpp b/Kernel/Syscalls/prctl.cpp index 10985ce136..13cb8be8f2 100644 --- a/Kernel/Syscalls/prctl.cpp +++ b/Kernel/Syscalls/prctl.cpp @@ -18,10 +18,8 @@ KResultOr Process::sys$prctl(int option, FlatPtr arg1, [[maybe_unused]] case PR_SET_DUMPABLE: set_dumpable(arg1); return 0; - default: - return EINVAL; } - return 0; + return EINVAL; } }