]> www.infradead.org Git - users/hch/configfs.git/commitdiff
platform/chrome: cros_ec_lpc: Fix error code in cros_ec_lpc_mec_read_bytes()
authorDan Carpenter <dan.carpenter@linaro.org>
Thu, 13 Jun 2024 13:55:14 +0000 (16:55 +0300)
committerTzung-Bi Shih <tzungbi@kernel.org>
Thu, 13 Jun 2024 15:12:12 +0000 (15:12 +0000)
We changed these functions to returning negative error codes, but this
first error path was accidentally overlooked.  It leads to a Smatch
warning:

    drivers/platform/chrome/cros_ec_lpc.c:181 ec_response_timed_out()
    error: uninitialized symbol 'data'.

Fix this by returning the error code instead of success.

Fixes: 68dbac0a58ef ("platform/chrome: cros_ec_lpc: MEC access can return error code")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Link: https://lore.kernel.org/r/e0b43fb5-ecc8-4fb4-9b76-c06dea8cc4c4@moroto.mountain
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/cros_ec_lpc.c

index ebe9fb143840d2b86c8579c9561f090f3540c7d0..f0470248b109872939463868910d221f1b855591 100644 (file)
@@ -139,7 +139,7 @@ static int cros_ec_lpc_mec_read_bytes(unsigned int offset, unsigned int length,
        int in_range = cros_ec_lpc_mec_in_range(offset, length);
 
        if (in_range < 0)
-               return 0;
+               return in_range;
 
        return in_range ?
                cros_ec_lpc_io_bytes_mec(MEC_IO_READ,
@@ -158,7 +158,7 @@ static int cros_ec_lpc_mec_write_bytes(unsigned int offset, unsigned int length,
        int in_range = cros_ec_lpc_mec_in_range(offset, length);
 
        if (in_range < 0)
-               return 0;
+               return in_range;
 
        return in_range ?
                cros_ec_lpc_io_bytes_mec(MEC_IO_WRITE,