mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
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>
This commit is contained in:
parent
cc05d352fb
commit
d8ac619a17
1 changed files with 5 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue