Skip to content

Commit 84995c8

Browse files
committed
drivers: smbus: stm32: add cast to avoid warning
Previously, the function `smbus_stm32_pcall()` implicitly cast `uint16_t *` to `uint8_t *`. Add an explicit cast to avoid warning. ```shell ..drivers/smbus/smbus_stm32.c:358:32: error: initialization of \ 'uint8_t *' {aka 'unsigned char *'} from incompatible pointer type \ 'uint16_t *' {aka 'short unsigned int *'} \ [-Werror=incompatible-pointer-types] 358 | .buf = &send_word, | ^ ..drivers/smbus/smbus_stm32.c:358:32: note: (near initialization \ for 'messages[1].buf') ..drivers/smbus/smbus_stm32.c:363:32: error: initialization of \ 'uint8_t *' {aka 'unsigned char *'} from incompatible pointer type \ 'uint16_t *' {aka 'short unsigned int *'} \ [-Werror=incompatible-pointer-types] 363 | .buf = recv_word, | ^~~~~~~~~ ``` Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
1 parent 91b1b84 commit 84995c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/smbus/smbus_stm32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,12 @@ static int smbus_stm32_pcall(const struct device *dev, uint16_t periph_addr, uin
355355
.flags = I2C_MSG_WRITE,
356356
},
357357
{
358-
.buf = &send_word,
358+
.buf = (uint8_t *)&send_word,
359359
.len = sizeof(send_word),
360360
.flags = I2C_MSG_WRITE,
361361
},
362362
{
363-
.buf = recv_word,
363+
.buf = (uint8_t *)recv_word,
364364
.len = sizeof(*recv_word),
365365
.flags = I2C_MSG_READ | I2C_MSG_RESTART,
366366
},

0 commit comments

Comments
 (0)