summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/compal-laptop.c
diff options
context:
space:
mode:
authorYizhuo <yzhai003@ucr.edu>2019-09-02 12:52:49 -0700
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-09-07 21:16:09 +0300
commit09e7f2805c352dc38d13f663613663574a0584ad (patch)
tree8c1ce94acf0e975a261439fa8110b8b433a1be09 /drivers/platform/x86/compal-laptop.c
parent37d960a4d753605ca248baea577eaaa96f5dccf0 (diff)
downloadlinux-09e7f2805c352dc38d13f663613663574a0584ad.tar.bz2
platform/x86: compal-laptop: Initialize "value" in ec_read_u8()
In function ec_read_u8(), variable "value" could be uninitialized if ec_read() fails. However, "value" is returned directly and used in its callers. This is potentially unsafe. Signed-off-by: Yizhuo <yzhai003@ucr.edu> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/compal-laptop.c')
-rw-r--r--drivers/platform/x86/compal-laptop.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index 09dfa6f48a1a..ab610376fdad 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -226,7 +226,7 @@ static const unsigned char pwm_lookup_table[256] = {
/* General access */
static u8 ec_read_u8(u8 addr)
{
- u8 value;
+ u8 value = 0;
ec_read(addr, &value);
return value;
}