summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rix <trix@redhat.com>2023-01-10 14:36:11 -0500
committerTzung-Bi Shih <tzungbi@kernel.org>2023-01-11 11:27:56 +0800
commit2ae3c610e7d21bc4a27da2b71f7007f2c4efce01 (patch)
tree06f05cc8b8c7b30979d94a6c8b744f3f312171b0
parent9e69b1b27b13eb4eb85405900e290c0d539454bf (diff)
platform/chrome: cros_ec_lpc: initialize the buf variable
Clang static analysis reports this problem drivers/platform/chrome/cros_ec_lpc.c:379:13: warning: The left operand of '!=' is a garbage value [core.UndefinedBinaryOperatorResult] if (buf[0] != 'E' || buf[1] != 'C') { ~~~~~~ ^ The check depends on the side effect of the read. When the read fails or is short, a buf containing garbage could be mistaken as correct. Signed-off-by: Tom Rix <trix@redhat.com> Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://lore.kernel.org/r/20230110193611.3573777-1-trix@redhat.com
-rw-r--r--drivers/platform/chrome/cros_ec_lpc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index 3708fa75feb1..68bba0fcafab 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -350,7 +350,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
struct acpi_device *adev;
acpi_status status;
struct cros_ec_device *ec_dev;
- u8 buf[2];
+ u8 buf[2] = {};
int irq, ret;
/*