diff options
author | Michał Barnaś <mb@semihalf.com> | 2022-01-21 16:43:53 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-17 15:56:34 +0000 |
commit | 926a15d2fec5f07169965d5dda3ba5180b68325f (patch) | |
tree | 1e15f80a54d641ac9b13c236b47a20ee0de94a04 /common/regulator.c | |
parent | 55680f70d2a1e61c193fc78ff1d51c7437803683 (diff) | |
download | chrome-ec-926a15d2fec5f07169965d5dda3ba5180b68325f.tar.gz |
zephyr: suppress warnings about pointers to unaligned data
Zephyr has enabled warnings about pointers to members of packed
structs. This resulted in failing compilation process.
This commit supresses some warnings by using void* intermediate
pointers and by using temporary variables if possible.
BUG=b:210501420
BRANCH=main
TEST=zmake testall && make buildall
Change-Id: Ia03322e80ae2b4ba42731b066066cc466bd92baf
Signed-off-by: Michał Barnaś <mb@semihalf.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3405041
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Sam Hurst <shurst@google.com>
Diffstat (limited to 'common/regulator.c')
-rw-r--r-- | common/regulator.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/common/regulator.c b/common/regulator.c index c3f5d0b99d..54d9e87521 100644 --- a/common/regulator.c +++ b/common/regulator.c @@ -16,14 +16,17 @@ hc_regulator_get_info(struct host_cmd_handler_args *args) { const struct ec_params_regulator_get_info *p = args->params; struct ec_response_regulator_get_info *r = args->response; + void *voltages_mv = r->voltages_mv; + uint16_t num_voltages; int rv; - rv = board_regulator_get_info(p->index, r->name, &r->num_voltages, - r->voltages_mv); + rv = board_regulator_get_info(p->index, r->name, &num_voltages, + voltages_mv); if (rv) return EC_RES_ERROR; + r->num_voltages = num_voltages; args->response_size = sizeof(*r); return EC_RES_SUCCESS; } @@ -69,13 +72,15 @@ hc_regulator_get_voltage(struct host_cmd_handler_args *args) { const struct ec_params_regulator_get_voltage *p = args->params; struct ec_response_regulator_get_voltage *r = args->response; + uint32_t voltage_mv; int rv; - rv = board_regulator_get_voltage(p->index, &r->voltage_mv); + rv = board_regulator_get_voltage(p->index, &voltage_mv); if (rv) return EC_RES_ERROR; + r->voltage_mv = voltage_mv; args->response_size = sizeof(*r); return EC_RES_SUCCESS; } |