diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-07-26 09:58:34 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-08 17:05:43 -0400 |
commit | d8ac619a172451f46efd421d280b639c224b3de6 (patch) | |
tree | 886d54fa7b2477c67d2e495e4088a93a206a563f /drivers/misc | |
parent | cc05d352fbc2b5df7f3aa4bd8a0711df5a1efa68 (diff) | |
download | u-boot-d8ac619a172451f46efd421d280b639c224b3de6.tar.gz u-boot-d8ac619a172451f46efd421d280b639c224b3de6.tar.bz2 u-boot-d8ac619a172451f46efd421d280b639c224b3de6.zip |
cros_ec: Fix an error code is cros_ec_get_sku_id()
The ec_command_inptr() function returns negative error codes or
the number of bytes that it was able to read. The cros_ec_get_sku_id()
function should return negative error codes. Right now it returns
positive error codes or negative byte counts.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/cros_ec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index 621d175217..9c1e6a5e3e 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -1100,8 +1100,11 @@ int cros_ec_get_sku_id(struct udevice *dev) ret = ec_command_inptr(dev, EC_CMD_GET_SKU_ID, 0, NULL, 0, (uint8_t **)&r, sizeof(*r)); - if (ret != sizeof(*r)) - return -ret; + if (ret != sizeof(*r)) { + if (ret >= 0) + ret = -EIO; + return ret; + } return r->sku_id; } |