@samitouri / QOSamiQemu / commits / 713e9e951a

hw/i3c/dw-i3c: Use ROUND_UP() for RX buffer allocation alignment

The RX temporary buffer allocation manually aligned the size using: num + (4 - (num & 0x03)) Replace this with ROUND_UP(num, 4) for better readability and consistency with common QEMU coding style. No functional change. Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> Reviewed-by: Jithu Joseph <jithu.joseph@oss.qualcomm.com> Link: https://lore.kernel.org/qemu-devel/20260303013322.1297499-2-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>

Jamin Lin committed Mar 3, 2026 at 01:33 UTC 713e9e951aca89e1e77d16bdad1b109b3d82fd60
1 file changed +1 -1
hw/i3c/dw-i3c.c
+1 -1
@@ -1282,7 +1282,7 @@ static uint16_t dw_i3c_rx(DWI3C *s, uint16_t num, bool is_i2c)
1282 * Allocate a temporary buffer to read data from the target.
1283 * Zero it and word-align it as well in case we're reading unaligned data.
1284 */
1285 - g_autofree uint8_t *data = g_new0(uint8_t, num + (4 - (num & 0x03)));
1285 + g_autofree uint8_t *data = g_new0(uint8_t, ROUND_UP(num, 4));
1286 uint32_t *data32 = (uint32_t *)data;
1287 /*
1288 * 32-bits since the I3C API wants a 32-bit number, even though the