From dd7ec447abaa93597c024c96c97c4d3fd89ab1b9 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Mon, 11 May 2020 16:31:57 -0700 Subject: [PATCH] lmkd: Remove unused variables and fix type mismatches Fix compilation warnings by removing unused variables and add typecasting whenever mixed type comparisons are performed. Bug: 147315292 Signed-off-by: Suren Baghdasaryan Merged-In: I7f0839d803a6bf6532f077208ce54aba761dc9fe Change-Id: I7f0839d803a6bf6532f077208ce54aba761dc9fe --- liblmkd_utils.cpp | 2 +- lmkd.cpp | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/liblmkd_utils.cpp b/liblmkd_utils.cpp index 45e867e..55d7f62 100644 --- a/liblmkd_utils.cpp +++ b/liblmkd_utils.cpp @@ -55,7 +55,7 @@ int lmkd_unregister_proc(int sock, struct lmk_procremove *params) { enum update_props_result lmkd_update_props(int sock) { LMKD_CTRL_PACKET packet; - size_t size; + int size; size = lmkd_pack_set_update_props(packet); if (TEMP_FAILURE_RETRY(write(sock, packet, size)) < 0) { diff --git a/lmkd.cpp b/lmkd.cpp index cd3d928..ede1958 100644 --- a/lmkd.cpp +++ b/lmkd.cpp @@ -2124,7 +2124,6 @@ static int find_and_kill_process(int min_score_adj, int kill_reason, const char } static int64_t get_memory_usage(struct reread_data *file_data) { - int ret; int64_t mem_usage; char *buf; @@ -2279,8 +2278,8 @@ static void mp_event_psi(int data, uint32_t events, struct polling_params *poll_ } bool kill_pending = is_kill_pending(); - if (kill_pending && - (kill_timeout_ms == 0 || get_time_diff_ms(&last_kill_tm, &curr_tm) < kill_timeout_ms)) { + if (kill_pending && (kill_timeout_ms == 0 || + get_time_diff_ms(&last_kill_tm, &curr_tm) < static_cast(kill_timeout_ms))) { /* Skip while still killing a process */ goto no_kill; } @@ -2457,7 +2456,6 @@ no_kill: } static void mp_event_common(int data, uint32_t events, struct polling_params *poll_params) { - int ret; unsigned long long evcount; int64_t mem_usage, memsw_usage; int64_t mem_pressure; @@ -2512,7 +2510,8 @@ static void mp_event_common(int data, uint32_t events, struct polling_params *po return; } - if (kill_timeout_ms && get_time_diff_ms(&last_kill_tm, &curr_tm) < kill_timeout_ms) { + if (kill_timeout_ms && + get_time_diff_ms(&last_kill_tm, &curr_tm) < static_cast(kill_timeout_ms)) { /* * If we're within the no-kill timeout, see if there's pending reclaim work * from the last killed process. If so, skip killing for now. @@ -3138,8 +3137,6 @@ static void mainloop(void) { } int issue_reinit() { - LMKD_CTRL_PACKET packet; - size_t size; int sock; sock = lmkd_connect();