From e0a4e5ab99a45faa196b3894ade8c375061a7ab6 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 30 Apr 2021 16:24:50 -0700 Subject: util: Add explicit casts When compiling with C++, the implicit casting that is performed in C is disallowed. Add casts in preparation for C++ compatibility. BRANCH=none BUG=b:144959033 TEST=make buildall Signed-off-by: Tom Hughes Change-Id: I5c25440819428db65225c772c1c5115a735db58a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2864519 Reviewed-by: Daisuke Nojiri --- util/comm-dev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'util/comm-dev.c') diff --git a/util/comm-dev.c b/util/comm-dev.c index 679f15225f..e73538b323 100644 --- a/util/comm-dev.c +++ b/util/comm-dev.c @@ -73,7 +73,7 @@ static int ec_command_dev(int command, int version, s_cmd.outsize = outsize; s_cmd.outdata = (uint8_t *)outdata; s_cmd.insize = insize; - s_cmd.indata = indata; + s_cmd.indata = (uint8_t *)(indata); r = ioctl(fd, CROS_EC_DEV_IOCXCMD, &s_cmd); if (r < 0) { @@ -107,7 +107,7 @@ static int ec_readmem_dev(int offset, int bytes, void *dest) if (!fake_it) { s_mem.offset = offset; s_mem.bytes = bytes; - s_mem.buffer = dest; + s_mem.buffer = (char *)(dest); r = ioctl(fd, CROS_EC_DEV_IOCRDMEM, &s_mem); if (r < 0 && errno == ENOTTY) fake_it = 1; @@ -134,8 +134,8 @@ static int ec_command_dev_v2(int command, int version, assert(outsize == 0 || outdata != NULL); assert(insize == 0 || indata != NULL); - s_cmd = malloc(sizeof(struct cros_ec_command_v2) + - MAX(outsize, insize)); + s_cmd = (struct cros_ec_command_v2 *)(malloc( + sizeof(struct cros_ec_command_v2) + MAX(outsize, insize))); if (s_cmd == NULL) return -EC_RES_ERROR; -- cgit v1.2.1