drivers: Fix more compiler warnings
Fix uninitialized variable warnings that were not previously caught by
old compiler.
Change-Id: I5014a235da41d32a3a1ae234286270ec9af875fc
Signed-off-by: Kyle Yan <kyan@codeaurora.org>
diff --git a/drivers/leds/leds-qpnp-flash-v2.c b/drivers/leds/leds-qpnp-flash-v2.c
index 08809a9..01e553c 100644
--- a/drivers/leds/leds-qpnp-flash-v2.c
+++ b/drivers/leds/leds-qpnp-flash-v2.c
@@ -677,7 +677,8 @@
#define VIN_FLASH_MIN_UV 3300000LL
static int qpnp_flash_led_calc_max_current(struct qpnp_flash_led *led)
{
- int ocv_uv, rbatt_uohm, ibat_now, voltage_hdrm_mv, rc;
+ int ocv_uv, ibat_now, voltage_hdrm_mv, rc;
+ int rbatt_uohm = 0;
int64_t ibat_flash_ua, avail_flash_ua, avail_flash_power_fw;
int64_t ibat_safe_ua, vin_flash_uv, vph_flash_uv, vph_flash_vdip;
diff --git a/drivers/soc/qcom/gladiator_hang_detect.c b/drivers/soc/qcom/gladiator_hang_detect.c
index 07ea43c..b0940ad 100644
--- a/drivers/soc/qcom/gladiator_hang_detect.c
+++ b/drivers/soc/qcom/gladiator_hang_detect.c
@@ -71,7 +71,7 @@
hang_dev->M1_threshold = threshold_val;
else if (offset == hang_dev->M2_offset)
hang_dev->M2_threshold = threshold_val;
- else if (offset == hang_dev->PCIO_offset)
+ else
hang_dev->PCIO_threshold = threshold_val;
}
@@ -86,7 +86,7 @@
*reg_value = hang_dev->M1_threshold;
else if (offset == hang_dev->M2_offset)
*reg_value = hang_dev->M2_threshold;
- else if (offset == hang_dev->PCIO_offset)
+ else
*reg_value = hang_dev->PCIO_threshold;
}
@@ -101,7 +101,7 @@
hang_dev->M1_enable = enabled;
else if (offset == hang_dev->M2_offset)
hang_dev->M2_enable = enabled;
- else if (offset == hang_dev->PCIO_offset)
+ else
hang_dev->PCIO_enable = enabled;
}
@@ -116,7 +116,7 @@
*reg_value = hang_dev->M1_enable;
else if (offset == hang_dev->M2_offset)
*reg_value = hang_dev->M2_enable;
- else if (offset == hang_dev->PCIO_offset)
+ else
*reg_value = hang_dev->PCIO_enable;
}
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 39008d7..ad538fe 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -1220,7 +1220,7 @@
void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
cputime_t *newval, cputime_t *oldval)
{
- unsigned long long now;
+ unsigned long long now = 0;
WARN_ON_ONCE(clock_idx == CPUCLOCK_SCHED);
cpu_timer_sample_group(clock_idx, tsk, &now);
diff --git a/kernel/trace/ipc_logging.c b/kernel/trace/ipc_logging.c
index 62110a3..fa7fd14 100644
--- a/kernel/trace/ipc_logging.c
+++ b/kernel/trace/ipc_logging.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -588,8 +588,12 @@
static void tsv_read_data(struct encode_context *ectxt,
void *data, uint32_t size)
{
- if (WARN_ON((ectxt->offset + size) > MAX_MSG_SIZE))
+ if (WARN_ON((ectxt->offset + size) > MAX_MSG_SIZE)) {
+ memcpy(data, (ectxt->buff + ectxt->offset),
+ MAX_MSG_SIZE - ectxt->offset - 1);
+ ectxt->offset += MAX_MSG_SIZE - ectxt->offset - 1;
return;
+ }
memcpy(data, (ectxt->buff + ectxt->offset), size);
ectxt->offset += size;
}
@@ -604,8 +608,12 @@
static void tsv_read_header(struct encode_context *ectxt,
struct tsv_header *hdr)
{
- if (WARN_ON((ectxt->offset + sizeof(*hdr)) > MAX_MSG_SIZE))
+ if (WARN_ON((ectxt->offset + sizeof(*hdr)) > MAX_MSG_SIZE)) {
+ memcpy(hdr, (ectxt->buff + ectxt->offset),
+ MAX_MSG_SIZE - ectxt->offset - 1);
+ ectxt->offset += MAX_MSG_SIZE - ectxt->offset - 1;
return;
+ }
memcpy(hdr, (ectxt->buff + ectxt->offset), sizeof(*hdr));
ectxt->offset += sizeof(*hdr);
}
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 2d03d5b..459577e 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -992,7 +992,7 @@
struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr;
char *sun_path = sunaddr->sun_path;
int err;
- unsigned int hash;
+ unsigned int hash = 0;
struct unix_address *addr;
struct hlist_head *list;
struct path path = { NULL, NULL };