Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e4d9186 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Remove unused addKernelPanicSubReason() return value." into main

parents 2b2fcaea 1c5911fa
Loading
Loading
Loading
Loading
+40 −42
Original line number Diff line number Diff line
@@ -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,21 +842,22 @@ 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) {
  if (pos == std::string::npos) return;

  static const std::vector<std::pair<const std::string, const std::string>> panicReasons = {
      {"Out of memory", "oom"},
      {"out of memory", "oom"},
@@ -885,20 +886,17 @@ bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) {
  for (auto& s : panicReasons) {
    if (console.find(panic + s.first, pos) != std::string::npos) {
      ret += "," + s.second;
        return true;
      return;
    }
  }
  auto reason = getSubreason(console, pos + panic.length(), /* newline */ false);
  if (reason.length() > 3) {
    ret += "," + reason;
  }
    return true;
  }
  return false;
}

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";