From 926a15d2fec5f07169965d5dda3ba5180b68325f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Barna=C5=9B?= Date: Fri, 21 Jan 2022 16:43:53 +0100 Subject: zephyr: suppress warnings about pointers to unaligned data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ś Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3405041 Reviewed-by: Ting Shen Reviewed-by: Sam Hurst --- common/regulator.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'common/regulator.c') 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; } -- cgit v1.2.1