Commit 2ae3c610 authored by Tom Rix's avatar Tom Rix Committed by Tzung-Bi Shih
Browse files

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: default avatarTom Rix <trix@redhat.com>
Signed-off-by: default avatarTzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20230110193611.3573777-1-trix@redhat.com
parent 9e69b1b2
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -350,7 +350,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
	struct acpi_device *adev;
	struct acpi_device *adev;
	acpi_status status;
	acpi_status status;
	struct cros_ec_device *ec_dev;
	struct cros_ec_device *ec_dev;
	u8 buf[2];
	u8 buf[2] = {};
	int irq, ret;
	int irq, ret;


	/*
	/*