[PATCH v5 3/5] i3c: master: dw: Map CCC hardware errors to I3C M0/M2

NG, TZE YEE tze.yee.ng at altera.com
Sun Jul 5 22:56:37 PDT 2026


On 3/7/2026 6:59 pm, sashiko-bot at kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] dw_i3c_ccc_set() fails to use dw_i3c_ccc_map_err(), resulting in inconsistent M0 error mapping for CCC SET commands
> --
> 
> commit 0ce229b1e86f48f8bc79433bee08c7da0909bad8
> Author: Adrian Ng Ho Yin <adrian.ho.yin.ng at altera.com>
> 
> i3c: master: dw: Map CCC hardware errors to I3C M0/M2
>      
> This commit maps DesignWare I3C master CCC hardware errors to I3C M0/M2 error
> codes. It introduces a new mapping function to handle this translation and
> updates CCC commands to use it.
> 
>> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
>> --- a/drivers/i3c/master/dw-i3c-master.c
>> +++ b/drivers/i3c/master/dw-i3c-master.c
> [ ... ]
>> @@ -781,10 +800,9 @@ static int dw_i3c_ccc_get(struct dw_i3c_master *master, struct i3c_ccc_cmd *ccc)
>>   
>>   	ret = xfer->ret;
>>   	cmd = &xfer->cmds[0];
>> +	ccc->err = dw_i3c_ccc_map_err(cmd->error);
>>   	if (!ret)
>>   		ccc->dests[0].payload.actual_len = cmd->rx_len;
>> -	if (cmd->error == RESPONSE_ERROR_IBA_NACK)
>> -		ccc->err = I3C_ERROR_M2;
> 
> [Severity: Medium]
> Should dw_i3c_ccc_set() also be updated to use the new dw_i3c_ccc_map_err()
> function?
> 
> It looks like dw_i3c_ccc_get() was updated to map M0/M2 errors, but
> dw_i3c_ccc_set() retains the legacy hardcoded check:
> 
> drivers/i3c/master/dw-i3c-master.c:dw_i3c_ccc_set() {
> ...
> 	ret = xfer->ret;
> 	if (xfer->cmds[0].error == RESPONSE_ERROR_IBA_NACK)
> 		ccc->err = I3C_ERROR_M2;
> ...
> }
> 
> Without using the new mapping function here, hardware errors (like CRC,
> Parity, or Frame errors) during CCC SET commands will not be mapped to
> I3C_ERROR_M0, resulting in inconsistent error handling compared to GET
> commands.
> 
>>   
>>   	return ret;
>>   }
> 

Hi maintainers,

Sashiko's comment is valid. dw_i3c_ccc_set() should use 
dw_i3c_ccc_map_err() as well. I will fix it in v6 so SET CCCs get the 
same M0/M2 mapping as GET. SET CCCs are not retried by default, but this 
keeps cmd->err consistent for callers.

Thanks,
Tze Yee


More information about the linux-i3c mailing list