On 3/1/2026 7:26 PM, Jamin Lin wrote:
> 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 <[email protected]>
> ---
>  hw/i3c/dw-i3c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/i3c/dw-i3c.c b/hw/i3c/dw-i3c.c
> index d742458129..3d8b95a14c 100644
> --- a/hw/i3c/dw-i3c.c
> +++ b/hw/i3c/dw-i3c.c
> @@ -1282,7 +1282,7 @@ static uint16_t dw_i3c_rx(DWI3C *s, uint16_t num, bool 
> is_i2c)
>       * Allocate a temporary buffer to read data from the target.
>       * Zero it and word-align it as well in case we're reading unaligned 
> data.
>       */
> -    g_autofree uint8_t *data = g_new0(uint8_t, num + (4 - (num & 0x03)));
> +    g_autofree uint8_t *data = g_new0(uint8_t, ROUND_UP(num, 4));
>      uint32_t *data32 = (uint32_t *)data;
>      /*
>       * 32-bits since the I3C API wants a 32-bit number, even though the

Looks good to me

Reviewed-by: Jithu Joseph <[email protected]>



Thanks
Jithu




Reply via email to