diff options
author | Tom Rini <trini@konsulko.com> | 2021-07-16 09:15:59 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-07-16 09:15:59 -0400 |
commit | c39946a2e2d062025c9fc8b34587dfdd45fd8703 (patch) | |
tree | 30326b7ad7ab94a6c936506636cf93d63b300384 /drivers/misc/cros_ec_sandbox.c | |
parent | d0dab9336db08bf562dd7ded4a417efd8570cee7 (diff) | |
parent | 92cf458f8ad9410dedbedd41d048d26620ce5f12 (diff) |
Merge branch '2021-07-15-assorted-fixes'
- Large number of Coverity reported issues addressed
- m41t62 bugfix
- Support more Android image compression formats
- FIT + DTO bugfix
Diffstat (limited to 'drivers/misc/cros_ec_sandbox.c')
-rw-r--r-- | drivers/misc/cros_ec_sandbox.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c index db5e3b0f51a..beea47caa33 100644 --- a/drivers/misc/cros_ec_sandbox.c +++ b/drivers/misc/cros_ec_sandbox.c @@ -5,6 +5,8 @@ * Copyright (c) 2013 The Chromium OS Authors. */ +#define LOG_CATEGORY UCLASS_CROS_EC + #include <common.h> #include <cros_ec.h> #include <dm.h> @@ -221,11 +223,12 @@ static int keyscan_read_fdt_matrix(struct ec_state *ec, ofnode node) int len; cell = ofnode_get_property(node, "linux,keymap", &len); + if (!cell) + return log_msg_ret("prop", -EINVAL); ec->matrix_count = len / 4; ec->matrix = calloc(ec->matrix_count, sizeof(*ec->matrix)); if (!ec->matrix) { - debug("%s: Out of memory for key matrix\n", __func__); - return -1; + return log_msg_ret("mem", -ENOMEM); } /* Now read the data */ @@ -243,13 +246,12 @@ static int keyscan_read_fdt_matrix(struct ec_state *ec, ofnode node) matrix->col >= KEYBOARD_COLS) { debug("%s: Matrix pos out of range (%d,%d)\n", __func__, matrix->row, matrix->col); - return -1; + return log_msg_ret("matrix", -ERANGE); } } if (upto != ec->matrix_count) { - debug("%s: Read mismatch from key matrix\n", __func__); - return -1; + return log_msg_ret("matrix", -E2BIG); } return 0; |