From: Yizhuo Date: Mon, 2 Sep 2019 19:52:49 +0000 (-0700) Subject: platform/x86: compal-laptop: Initialize "value" in ec_read_u8() X-Git-Tag: v5.4-rc1~57^2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=09e7f2805c352dc38d13f663613663574a0584ad;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Andy Shevchenko --- diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c index 09dfa6f..ab61037 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; }