Skip to content

Commit b31251b

Browse files
JarmouniAkartben
authored andcommitted
drivers: stm32: i2c rtio: Fix 'timings' array size
'timings' is an array of 'struct i2c_config_timing' (3 x uint32_t). 'i2c_timings_##index' is an array of uint32_t (hence the cast when it is assigned to 'timings'). Therefore 'ARRAY_SIZE(i2c_timings_##index)' is off by a factor 3 when used for n_timings. Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
1 parent d17956a commit b31251b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/i2c/i2c_ll_stm32_rtio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ static const struct i2c_stm32_config i2c_stm32_cfg_##index = { \
239239
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(index), \
240240
IF_ENABLED(DT_HAS_COMPAT_STATUS_OKAY(st_stm32_i2c_v2), \
241241
(.timings = (const struct i2c_config_timing *) i2c_timings_##index, \
242-
.n_timings = ARRAY_SIZE(i2c_timings_##index),)) \
242+
.n_timings = \
243+
sizeof(i2c_timings_##index) / (sizeof(struct i2c_config_timing)),)) \
243244
}; \
244245
\
245246
I2C_RTIO_DEFINE(CONCAT(_i2c, index, _stm32_rtio), \

0 commit comments

Comments
 (0)