[PATCH 2/7] i3c: mipi-i3c-hci: Stop reading Extended Capabilities if capability ID is 0

Frank Li Frank.li at nxp.com
Tue Dec 9 08:22:53 PST 2025


On Tue, Dec 09, 2025 at 01:50:59PM +0200, Adrian Hunter wrote:
> Extended Capability ID value 0 is special.  It signifies the end of the
> list.  Stop reading Extended Capabilities if capability ID is 0.
>
> Signed-off-by: Adrian Hunter <adrian.hunter at intel.com>
> ---
Reviewed-by: Frank Li <Frank.Li at nxp.com>
>  drivers/i3c/master/mipi-i3c-hci/ext_caps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master/mipi-i3c-hci/ext_caps.c b/drivers/i3c/master/mipi-i3c-hci/ext_caps.c
> index 40939af0b0e3..024bccf23fd0 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/ext_caps.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/ext_caps.c
> @@ -271,7 +271,7 @@ int i3c_hci_parse_ext_caps(struct i3c_hci *hci)
>  		cap_length = FIELD_GET(CAP_HEADER_LENGTH, cap_header);
>  		dev_dbg(&hci->master.dev, "id=0x%02x length=%d",
>  			cap_id, cap_length);
> -		if (!cap_length)
> +		if (!cap_id || !cap_length)
>  			break;
>  		if (curr_cap + cap_length * 4 >= end) {
>  			dev_err(&hci->master.dev,
> --
> 2.51.0
>
>
> --
> linux-i3c mailing list
> linux-i3c at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c



More information about the linux-i3c mailing list