Remove unused addKernelPanicSubReason() return value.

The only caller that was looking at the return value just stopped.

Test: treehugger
Change-Id: Icf2508e8e1ee4969918eadeb580f70236ba53496
This commit is contained in:
Elliott Hughes 2024-02-07 22:22:13 +00:00
parent c72c9a6d3c
commit 1c5911fade

View file

@ -830,7 +830,7 @@ std::string getSubreason(const std::string& content, size_t pos, bool quoted) {
return subReason;
}
bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) {
void addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) {
// Check for kernel panic types to refine information
if ((console.rfind("SysRq : Trigger a crash") != std::string::npos) ||
(console.rfind("PC is at sysrq_handle_crash+") != std::string::npos)) {
@ -842,63 +842,61 @@ bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) {
if (pos != std::string::npos) {
ret += "," + getSubreason(console, pos + strlen(sysrqSubreason), /* quoted */ true);
}
return true;
return;
}
if (console.rfind("Unable to handle kernel NULL pointer dereference at virtual address") !=
std::string::npos) {
ret = "kernel_panic,null";
return true;
return;
}
if (console.rfind("Kernel BUG at ") != std::string::npos) {
ret = "kernel_panic,bug";
return true;
return;
}
std::string panic("Kernel panic - not syncing: ");
auto pos = console.rfind(panic);
if (pos != std::string::npos) {
static const std::vector<std::pair<const std::string, const std::string>> panicReasons = {
{"Out of memory", "oom"},
{"out of memory", "oom"},
{"Oh boy, that early out of memory", "oom"}, // omg
{"BUG!", "bug"},
{"hung_task: blocked tasks", "hung"},
{"audit: ", "audit"},
{"scheduling while atomic", "atomic"},
{"Attempted to kill init!", "init"},
{"Requested init", "init"},
{"No working init", "init"},
{"Could not decompress init", "init"},
{"RCU Stall", "hung,rcu"},
{"stack-protector", "stack"},
{"kernel stack overflow", "stack"},
{"Corrupt kernel stack", "stack"},
{"low stack detected", "stack"},
{"corrupted stack end", "stack"},
{"subsys-restart: Resetting the SoC - modem crashed.", "modem"},
{"subsys-restart: Resetting the SoC - adsp crashed.", "adsp"},
{"subsys-restart: Resetting the SoC - dsps crashed.", "dsps"},
{"subsys-restart: Resetting the SoC - wcnss crashed.", "wcnss"},
};
if (pos == std::string::npos) return;
ret = "kernel_panic";
for (auto& s : panicReasons) {
if (console.find(panic + s.first, pos) != std::string::npos) {
ret += "," + s.second;
return true;
}
static const std::vector<std::pair<const std::string, const std::string>> panicReasons = {
{"Out of memory", "oom"},
{"out of memory", "oom"},
{"Oh boy, that early out of memory", "oom"}, // omg
{"BUG!", "bug"},
{"hung_task: blocked tasks", "hung"},
{"audit: ", "audit"},
{"scheduling while atomic", "atomic"},
{"Attempted to kill init!", "init"},
{"Requested init", "init"},
{"No working init", "init"},
{"Could not decompress init", "init"},
{"RCU Stall", "hung,rcu"},
{"stack-protector", "stack"},
{"kernel stack overflow", "stack"},
{"Corrupt kernel stack", "stack"},
{"low stack detected", "stack"},
{"corrupted stack end", "stack"},
{"subsys-restart: Resetting the SoC - modem crashed.", "modem"},
{"subsys-restart: Resetting the SoC - adsp crashed.", "adsp"},
{"subsys-restart: Resetting the SoC - dsps crashed.", "dsps"},
{"subsys-restart: Resetting the SoC - wcnss crashed.", "wcnss"},
};
ret = "kernel_panic";
for (auto& s : panicReasons) {
if (console.find(panic + s.first, pos) != std::string::npos) {
ret += "," + s.second;
return;
}
auto reason = getSubreason(console, pos + panic.length(), /* newline */ false);
if (reason.length() > 3) {
ret += "," + reason;
}
return true;
}
return false;
auto reason = getSubreason(console, pos + panic.length(), /* newline */ false);
if (reason.length() > 3) {
ret += "," + reason;
}
}
bool addKernelPanicSubReason(const std::string& content, std::string& ret) {
return addKernelPanicSubReason(pstoreConsole(content), ret);
void addKernelPanicSubReason(const std::string& content, std::string& ret) {
addKernelPanicSubReason(pstoreConsole(content), ret);
}
const char system_reboot_reason_property[] = "sys.boot.reason";