lmkd: Remove unused variables and fix type mismatches

Fix compilation warnings by removing unused variables and add typecasting
whenever mixed type comparisons are performed.

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I7f0839d803a6bf6532f077208ce54aba761dc9fe
This commit is contained in:
Suren Baghdasaryan 2020-05-11 16:31:57 -07:00
parent 1d0ebeaa9c
commit ed715a3424
2 changed files with 5 additions and 8 deletions

View File

@ -55,7 +55,7 @@ int lmkd_unregister_proc(int sock, struct lmk_procremove *params) {
enum update_props_result lmkd_update_props(int sock) { enum update_props_result lmkd_update_props(int sock) {
LMKD_CTRL_PACKET packet; LMKD_CTRL_PACKET packet;
size_t size; int size;
size = lmkd_pack_set_update_props(packet); size = lmkd_pack_set_update_props(packet);
if (TEMP_FAILURE_RETRY(write(sock, packet, size)) < 0) { if (TEMP_FAILURE_RETRY(write(sock, packet, size)) < 0) {

View File

@ -2125,7 +2125,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) { static int64_t get_memory_usage(struct reread_data *file_data) {
int ret;
int64_t mem_usage; int64_t mem_usage;
char *buf; char *buf;
@ -2289,8 +2288,8 @@ static void mp_event_psi(int data, uint32_t events, struct polling_params *poll_
} }
bool kill_pending = is_kill_pending(); bool kill_pending = is_kill_pending();
if (kill_pending && if (kill_pending && (kill_timeout_ms == 0 ||
(kill_timeout_ms == 0 || get_time_diff_ms(&last_kill_tm, &curr_tm) < kill_timeout_ms)) { get_time_diff_ms(&last_kill_tm, &curr_tm) < static_cast<long>(kill_timeout_ms))) {
/* Skip while still killing a process */ /* Skip while still killing a process */
goto no_kill; goto no_kill;
} }
@ -2477,7 +2476,6 @@ no_kill:
} }
static void mp_event_common(int data, uint32_t events, struct polling_params *poll_params) { static void mp_event_common(int data, uint32_t events, struct polling_params *poll_params) {
int ret;
unsigned long long evcount; unsigned long long evcount;
int64_t mem_usage, memsw_usage; int64_t mem_usage, memsw_usage;
int64_t mem_pressure; int64_t mem_pressure;
@ -2532,7 +2530,8 @@ static void mp_event_common(int data, uint32_t events, struct polling_params *po
return; 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<long>(kill_timeout_ms)) {
/* /*
* If we're within the no-kill timeout, see if there's pending reclaim work * 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. * from the last killed process. If so, skip killing for now.
@ -3158,8 +3157,6 @@ static void mainloop(void) {
} }
int issue_reinit() { int issue_reinit() {
LMKD_CTRL_PACKET packet;
size_t size;
int sock; int sock;
sock = lmkd_connect(); sock = lmkd_connect();