Re: [PATCH v2 06/12] hw/i3c: fix default return value of d2_i3c_send()
Akihiko Odaki <[email protected]> Tue, 28 Jul 2026 15:43:39 +0900
| Newsgroups | org.kernel.vger.linux-cxl,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
On 2026/07/27 16:40, Philippe Mathieu-Daudé wrote:
> On 26/7/26 22:44, Marc-André Lureau wrote:
>> Fixes: 208772a189f9 ("hw/i3c/dw-i3c: Add data TX and RX")
>> Signed-off-by: Marc-André Lureau <[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 6386499dd9fc..7b887fbd60cb 100644
>> --- a/hw/i3c/dw-i3c.c
>> +++ b/hw/i3c/dw-i3c.c
>> @@ -430,7 +430,7 @@ static int dw_i3c_send_start(DWI3C *s, uint8_t
>> addr, bool is_recv, bool is_i2c)
>> static int dw_i3c_send(DWI3C *s, const uint8_t *data, uint32_t
>> num_to_send,
>> uint32_t *num_sent, bool is_i2c)
>> {
>> - int ret;
>> + int ret = 0;
>
> So IIUC the issue is being called with num_to_send=0.
> Can that happen? Apparently no. Could we assert it is
> non-zero?
I kind of prefer to apply the same logic I suggested for walk_gpt():
https://lore.kernel.org/qemu-devel/[email protected]/
i.e., if num_to_send == 0, there is no work to do, so the default value
should tell that no error happened. ret = 0 does that.
Regards,
Akihiko Odaki