From nobody Fri Apr 3 16:03:02 2026 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A7083BA234 for ; Mon, 23 Mar 2026 16:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282328; cv=none; b=NPiC+cK6eHaZ6s5JzY5MxKdNefnolXad3atMZvlkoM85XqW8vtu8dWoTO5p/LE3SgdGBDVC9bjNRSdkGyVGKs9V5RStskdKGL6mSNNmSYZDeOoyNaZ2A8xJ3lb2iYjPRD2J9l3uDJeuBw1ht0svUvfpBMfzti35o64kdxERTl6k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282328; c=relaxed/simple; bh=3ZBequMiTUpfPBAKWSfnNwbUDplLtxinP1SufpszsgI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=P7q9b/Klzi3DnvymsfB/Fhs7SXlvA6w5hfi1zRTdNNQaTrvKl7AXwI/wyGd5ETZf80ViLBatJrwccfc8xmV1zuNXKLiKYGoPf9PCt6ruQOh2zFfnjl7IU2L4g0E9PWNP1G2i4ydKjPvWHtK94ipL472Fjr6UCX4E1U6+UF6LW18= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=pmFJn+PX; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="pmFJn+PX" Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62NDJE3n2959738; Mon, 23 Mar 2026 12:11:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=/Ryyt O51kIokrwY34bif8WzywVVWCFoTt6FqTMRSmTs=; b=pmFJn+PXrJj8gcQLj9Ikk bVfIaUADFjcxpSCi8DBlzqxEXyedtDFWOz7D8fmxJ5OPbCOjGQ498vP8jWy7xTXT eM2EN0CitYeOTtBeBKN+kxpq0Ao5+va4Lb93mkLGB4a5Pkrx0CUJtKi0tf5NP3e/ LQR5Kces48UwSOjGL5G4lpHgg8IQpd6kJBDdz5OINgvX4Im2pva7xLzlpReI54sp utjUqDC9DRkvn8PI2V5hIzS0GXsn9HY4Gh77iV1yJjZZg9P2dw/Co0l1lJokdvr/ +/uwQp2FZLBKPhUb6aYhEnJHuQxb+V/AIdGBTW896fz8JoPZ3H6gGxAck0PHA8Hp w== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4d1r81yqjf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Mar 2026 12:11:53 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 62NGBpTJ044709 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 23 Mar 2026 12:11:52 -0400 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Mon, 23 Mar 2026 12:11:51 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Mon, 23 Mar 2026 12:11:51 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.1748.37 via Frontend Transport; Mon, 23 Mar 2026 12:11:51 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.44.3.69] (may be forged)) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 62NGBYnr019356; Mon, 23 Mar 2026 12:11:45 -0400 From: Jorge Marques Date: Mon, 23 Mar 2026 17:11:29 +0100 Subject: [PATCH v3 1/5] i3c: master: Move rstdaa error suppression Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260323-ad4062-positive-error-fix-v3-1-30bdc68004be@analog.com> References: <20260323-ad4062-positive-error-fix-v3-0-30bdc68004be@analog.com> In-Reply-To: <20260323-ad4062-positive-error-fix-v3-0-30bdc68004be@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , "Dan Carpenter" , Jonathan Cameron , Jorge Marques , Adrian Hunter X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774282294; l=1781; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=3ZBequMiTUpfPBAKWSfnNwbUDplLtxinP1SufpszsgI=; b=SxzFEaVP+xIffwg6ugRlcWopF/ccTpcFpw7MRQNu4Wakf3y9/tQ9zqB7sbIDS6HjIjBYBNuQf AwwfejoMZSFCbfdi3Xo1KnlifDHnrt7osQ3weaXndYkYdoNLEwr2Pz+ X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzIzMDEyMyBTYWx0ZWRfX0alqcZMkZjuj w52Mxh1leNZ9C1rpmzFUi5Ul6xs5DPsSCYmazTdZT6jZ515RslrMdrqKT3Gk1uBgNZthFVxbgBO kb6pyLju9sdNg8GTMQStzg6pIbvUjv4yGb1LCPC1xu5513sJ5zqS/R/3PylDuX9eGzxkFWohjc9 inHfXLUrbz5HUOcH+ff2Oz1G83UIeTvuNG8gQTQz2nILqPqzfrWkmjeuanYqh+YVvvKGXcL+wTj TYlnYcTCNzS/NASahVljr4Oajva3UeWZ8e94mJeg/AxK/JAo2pXxgw3N7FD6jyEt3e0FJtF3OK7 XBHs+2w8NdyQroHCRYlVCmX3ZMMAiKs9uLjZuKO6giM9e5J53L2qOn0ZSYcqLyu54Si73/a2JAu lcVekFno+VEaM6CDWfXu0fbTqEHBfrPs/6SEuVqf9z9SG0bOmJMG6sPUEbBAm8JqSOsQZj59iHg QJeCHFtR0wmkNdzvEPg== X-Authority-Analysis: v=2.4 cv=edIwvrEH c=1 sm=1 tr=0 ts=69c16649 cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=0sLvza09kfJOxVLZPwjg:22 a=Z0pTeXoby7EwIRygza74:22 a=8AirrxEcAAAA:8 a=QyXUC8HyAAAA:8 a=gAnH3GRIAAAA:8 a=Ao6iV3P8B_HNZf798VcA:9 a=QEXdDO2ut3YA:10 a=ST-jHhOKWsTCqRlWije3:22 X-Proofpoint-ORIG-GUID: Hp0snLwimghyy3wZrYGO-ee82kZjU_Eu X-Proofpoint-GUID: Hp0snLwimghyy3wZrYGO-ee82kZjU_Eu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-23_04,2026-03-23_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 adultscore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603230123 Prepare to fix improper Mx positive error propagation in later commits by handling Mx error codes where the i3c_ccc_cmd command is allocated. Two of the four i3c_master_rstdaa_locked() are error paths that already suppressed the return value, the remaining two are changed to handle the I3C_ERROR_M2 Mx error code inside i3c_master_rstdaa_locked(), checking cmd->err directly. Reviewed-by: Frank Li Reviewed-by: Adrian Hunter Signed-off-by: Jorge Marques --- drivers/i3c/master.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 9e6be49bebb2c..7f4630ac8f0bc 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1016,6 +1016,10 @@ static int i3c_master_rstdaa_locked(struct i3c_maste= r_controller *master, ret =3D i3c_master_send_ccc_cmd_locked(master, &cmd); i3c_ccc_cmd_dest_cleanup(&dest); =20 + /* No active devices on the bus. */ + if (ret && cmd.err =3D=3D I3C_ERROR_M2) + ret =3D 0; + return ret; } =20 @@ -1794,11 +1798,8 @@ int i3c_master_do_daa_ext(struct i3c_master_controll= er *master, bool rstdaa) =20 i3c_bus_maintenance_lock(&master->bus); =20 - if (rstdaa) { + if (rstdaa) rstret =3D i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR); - if (rstret =3D=3D I3C_ERROR_M2) - rstret =3D 0; - } =20 ret =3D master->ops->do_daa(master); =20 @@ -2093,7 +2094,7 @@ static int i3c_master_bus_init(struct i3c_master_cont= roller *master) * (assigned by the bootloader for example). */ ret =3D i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR); - if (ret && ret !=3D I3C_ERROR_M2) + if (ret) goto err_bus_cleanup; =20 if (master->ops->set_speed) { --=20 2.51.1 From nobody Fri Apr 3 16:03:02 2026 Received: from mx0b-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 541903AB277 for ; Mon, 23 Mar 2026 16:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282327; cv=none; b=iRGGXzsB1bJgTv+91MFk+6vN6hg47hlg8AAIyotCNFzomzb9hsaFFjDmh8qLdXvU0iFi7v1DNcF8vHi0laKNo8VdcKOtW9SZT/Z142QHfKFCvf4/VSaxlixzOHHWsmcz65Uuoi6Cfa8FIMpS6RLSLGgEXbeL4Zfnmcwl5fKHIxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282327; c=relaxed/simple; bh=ccXa3/KY5qLJj4TgciT2buI5BrqCzsF3ggv3lfciV/U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=OkVAzcb/Fq9maVTW1AP7fdmD2N9eiBdkiaQmJQuA4pWBMWoUfUVskN5dxNmHq/x+z2BHpiNxNjcCf76Gid3SGmNOIb9Zskr+hj2tl1Y/15xdn2fH9Ea4xzH3o54804sLnCnG8ZRP8EplUxpcaMIJQQU2eVNPIZ4APIOpJQ5dt3w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=xdZi6Yk2; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="xdZi6Yk2" Received: from pps.filterd (m0375855.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62NBE4HM4072644; Mon, 23 Mar 2026 12:11:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=4fpDi uqkRGna7MMzVmnbYT3i/AqwEU5qiAradGGvOJ4=; b=xdZi6Yk2bOWS3sLpgteu0 lxWJ6aGuM9F1rSBoZ51so3ef3eAx5bg9ca5VOJdRS1OHZ/dglgUbT9i+2++86syF hFfNPhRU/J/+idSNgcQaAjj3yYztdH/JN54Fpehajn9vT94jxR9FfDzW22raAkhi ZI4CuWQsIoDkpcE4Rc4+nL7APnMR+qDePYJT1Itq8M65JYuErxnhSdwbHBgE2UNH 65Ln6wL2Gc4IHAf8Xydi6hXrfFmqegnibfWHFQZfYKVLh3NEJNTsN7HEer7jetay iFVn3R5+IgbVJg1VFjuJ149bGA2aXYGWWrJn3BW5h3eAgE3gwjE9Tsn3m7Pxrr6S g== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 4d2pxqbvd9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Mar 2026 12:11:51 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 62NGBoNf044706 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 23 Mar 2026 12:11:50 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Mon, 23 Mar 2026 12:11:50 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.1748.37 via Frontend Transport; Mon, 23 Mar 2026 12:11:50 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.44.3.69] (may be forged)) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 62NGBYns019356; Mon, 23 Mar 2026 12:11:47 -0400 From: Jorge Marques Date: Mon, 23 Mar 2026 17:11:30 +0100 Subject: [PATCH v3 2/5] i3c: master: Move entdaa error suppression Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260323-ad4062-positive-error-fix-v3-2-30bdc68004be@analog.com> References: <20260323-ad4062-positive-error-fix-v3-0-30bdc68004be@analog.com> In-Reply-To: <20260323-ad4062-positive-error-fix-v3-0-30bdc68004be@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , Dan Carpenter , Jonathan Cameron , Jorge Marques , Adrian Hunter X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774282294; l=2469; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=ccXa3/KY5qLJj4TgciT2buI5BrqCzsF3ggv3lfciV/U=; b=zoTi5Gh9i4O3Wn29I460AgFHWtJ2dqfp79dnPBmgGVR1jTGeaAVCqSrrAZOpUZFlfj4FLdZqa rP3uRUYBOtQADmoeatxOXKzUDixgxK7Vn+j4oZa+7EIjF0NBBjFj8e9 X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=ALPFdfBd c=1 sm=1 tr=0 ts=69c16647 cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=0sLvza09kfJOxVLZPwjg:22 a=N--XFCr6TIEc_64PeIT2:22 a=8AirrxEcAAAA:8 a=QyXUC8HyAAAA:8 a=gAnH3GRIAAAA:8 a=lW4FyyzJGg7ItnWL1goA:9 a=QEXdDO2ut3YA:10 a=ST-jHhOKWsTCqRlWije3:22 X-Proofpoint-ORIG-GUID: FKsn_9g92PWClqcxxAFE614kZpo-oGGF X-Proofpoint-GUID: FKsn_9g92PWClqcxxAFE614kZpo-oGGF X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzIzMDEyMyBTYWx0ZWRfX7U6odw56nuFO xb73x66WvbcdfaYz5jBz4E4a1dMpcuv0+WTr/VCGjDsMQZQJfc2UMEDx3n+NMLTs4WJj++eRb3o VVVUwY/Ym9bEocPk154uhbp4SkozoEv8UO0ju1AgKXawGHElRwkJWMOFKYZfLWV1y8yVAYhhhjH KdJ0IRW5NkSdb4sQWNyyP4pKNq9clL30vvAnLz3ivHsMYVEZgLiKj0XsSFp2sF0sAr1ClowstPZ XlHzd4ErlNwwacJJvLbGwSLg2AEsos9FZT/A6kccx6GuX/KFR9fTnvotcItJzn25w2x4mzGLtKX MCpX8IgbotXtGG8MNAG1ppZOQrJXrGlu6GzigOcqFCxcVxMETPkaAbCVGaMZjP6QioWe/e2kWgt SRCPcpxSUnwGQ12R09qmdibWnlkyfky02WA3yNQ6AvyBuxfcDocnZDYe5BJnF0pAnRzVQ98QZk4 Fypg4dPcVP6nztUfG8A== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-23_04,2026-03-23_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 clxscore=1015 spamscore=0 impostorscore=0 bulkscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603230123 Prepare to fix improper Mx positive error propagation in later commits by handling Mx error codes where the i3c_ccc_cmd command is allocated. The CCC ENTDAA is invoked with i3c_master_entdaa_locked() and yields error I3C_ERROR_M2 if there are no devices active on the bus. Some controllers may also yield if there are no more devices need an dynamic address, since the sequence do always end in a NACK. Handle inside i3c_master_entdaa_locked(), checking cmd->err directly. Both call sites are updated, adi_i3c_master_do_daa() and cdns_i3c_master_do_daa(). Reviewed-by: Frank Li Reviewed-by: Adrian Hunter Signed-off-by: Jorge Marques --- drivers/i3c/master.c | 4 ++++ drivers/i3c/master/adi-i3c-master.c | 3 +-- drivers/i3c/master/i3c-master-cdns.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 7f4630ac8f0bc..1e2c086a24ac2 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1050,6 +1050,10 @@ int i3c_master_entdaa_locked(struct i3c_master_contr= oller *master) ret =3D i3c_master_send_ccc_cmd_locked(master, &cmd); i3c_ccc_cmd_dest_cleanup(&dest); =20 + /* No active devices need an address. */ + if (ret && cmd.err =3D=3D I3C_ERROR_M2) + ret =3D 0; + return ret; } EXPORT_SYMBOL_GPL(i3c_master_entdaa_locked); diff --git a/drivers/i3c/master/adi-i3c-master.c b/drivers/i3c/master/adi-i= 3c-master.c index 6616f751075ae..fb9a488304469 100644 --- a/drivers/i3c/master/adi-i3c-master.c +++ b/drivers/i3c/master/adi-i3c-master.c @@ -655,8 +655,7 @@ static int adi_i3c_master_do_daa(struct i3c_master_cont= roller *m) =20 writel(irq_mask, master->regs + REG_IRQ_MASK); =20 - /* DAA always finishes with CE2_ERROR or NACK_RESP */ - if (ret && ret !=3D I3C_ERROR_M2) + if (ret) return ret; =20 /* Add I3C devices discovered */ diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-= master-cdns.c index b78aebf6b2ca4..5cfec6761494d 100644 --- a/drivers/i3c/master/i3c-master-cdns.c +++ b/drivers/i3c/master/i3c-master-cdns.c @@ -1143,7 +1143,7 @@ static int cdns_i3c_master_do_daa(struct i3c_master_c= ontroller *m) } =20 ret =3D i3c_master_entdaa_locked(&master->base); - if (ret && ret !=3D I3C_ERROR_M2) + if (ret) return ret; =20 newdevs =3D readl(master->regs + DEVS_CTRL) & DEVS_CTRL_DEVS_ACTIVE_MASK; --=20 2.51.1 From nobody Fri Apr 3 16:03:02 2026 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 542393B19AC for ; Mon, 23 Mar 2026 16:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282329; cv=none; b=DIZuXqZtg+43FRfNZ5UlWafPStUItK/MoVck+vIu1modIpEfq0RpWcOl+Gvgf1gpCL9SzIR93dzrxnL4v43efIXrCnw/JTKEVzo8OXo9PcZgpwVuf1iq4xrZU9NEO8i9w8GhpEychOrzjtkIH0QMYhE5mgdd88j32D4RsZQ2x+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282329; c=relaxed/simple; bh=3Pb2fafyWjb4Ni826KHR4JgIYz8ThnNJh5Q6cXJbGqE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=JRgH3ysNPfEjDxdSZbPHvA/nZ5iorQe1pUcQdREjDxa6MN2HXVpxUmk2v8GbvCrgM+gGMvU07qDvP8tP0WSQeSj9GKL63+rdsqV02wxLLQUXkzJ6XITfQ2YW1QBFlH2ou7kpH4ENm2BOjnvo5+boPYLZu5uM3iU6kNdXlGfpE7c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=s5WodNUr; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="s5WodNUr" Received: from pps.filterd (m0516787.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62NETu6c2269582; Mon, 23 Mar 2026 12:11:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=jqQ01 oRDr35TiwU4wo4xjhtddDhKPHKqduRPfZ8Lx7s=; b=s5WodNUrzJb/8OvBvrNUL Ca/d474f5uOOI03ITXZZY+rYXNDWx40PCZIAk10c7aWDwcLgJckZ4Ezt3BtkLW6s XbmCId+BDYwOJUO8gIiy7x3xpYi2xsDsXRJPQmaiPaOOF3OOUUzDNH67b/rgwNXs O4KkoPAcUmpFTZHDSPCQpsfLpVaH9JpYikPrFaPhf8OM2F/ptJOqiQE/hpZ7cohA 30dZelulx56+PEhcKV783So9KspAWpERaVmIplWbVSLKkSFR4t1CMaXJ2VG1O46i YZ8MKOXuz6iPACEs3FmEkFqNaOhEG57snpbjk8k74ei1bwq05ndSCcAn1TlEaI5h A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4d2cnew41g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Mar 2026 12:11:53 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 62NGBqDF044712 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 23 Mar 2026 12:11:52 -0400 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Mon, 23 Mar 2026 12:11:51 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Mon, 23 Mar 2026 12:11:51 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.1748.37 via Frontend Transport; Mon, 23 Mar 2026 12:11:51 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.44.3.69] (may be forged)) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 62NGBYnt019356; Mon, 23 Mar 2026 12:11:48 -0400 From: Jorge Marques Date: Mon, 23 Mar 2026 17:11:31 +0100 Subject: [PATCH v3 3/5] i3c: master: Move bus_init error suppression Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260323-ad4062-positive-error-fix-v3-3-30bdc68004be@analog.com> References: <20260323-ad4062-positive-error-fix-v3-0-30bdc68004be@analog.com> In-Reply-To: <20260323-ad4062-positive-error-fix-v3-0-30bdc68004be@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , "Dan Carpenter" , Jonathan Cameron , Jorge Marques , Adrian Hunter X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774282294; l=3409; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=3Pb2fafyWjb4Ni826KHR4JgIYz8ThnNJh5Q6cXJbGqE=; b=f5V8y8/jg6vSxWtZXhI+qJqLtHol0PYp+sP9lKFx/UVVrRH1II66iijG8l+5plhXMkvIzgt2T AlJoR8VxdLYBGfiQ2Eo8whuFiTNfILCU/wN3bBzWklAWszB6dpuq3PW X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=UcVciaSN c=1 sm=1 tr=0 ts=69c16649 cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=0sLvza09kfJOxVLZPwjg:22 a=OmVn7CZJonkx5R5zMQLL:22 a=8AirrxEcAAAA:8 a=QyXUC8HyAAAA:8 a=gAnH3GRIAAAA:8 a=dlK5iWcZi1ZAZcL_4pgA:9 a=QEXdDO2ut3YA:10 a=ST-jHhOKWsTCqRlWije3:22 X-Proofpoint-ORIG-GUID: c6rMEoqYcBcZxjeOtRHM4RHyHXU1PDPw X-Proofpoint-GUID: c6rMEoqYcBcZxjeOtRHM4RHyHXU1PDPw X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzIzMDEyMyBTYWx0ZWRfX8ao5wzvbMO9A jtx5G7CBqgJS2802xpFcvpgm98cXmOh3ANsmJAigqsXAbTCK1s7D3cHnee01VV2QbFYrX8j97/R C/N60djFrLPW3DxZ8ZtR6HMaz0uf6mNsOEXJLryqj5HK11Zy18qVFPt5CAFYPb6Jpi24RNe1kE+ HQrBv9Rk2L3PMysrZuBiM8vQhHj/227TNbfK3L/hJbm/sha3Wg8PoDybPGJ8dtt9fE3QbrHjggx i1m7ZO2stiLeCXOS++Nj4SeS+kJmXqm6kvA9NKbaXBCdsCLzdvZsaxvQf6YNRU5pLhbXmuwrY9J fr+JeGC5EaTraDhOTOisNbP8zNbBS6JobJmqm44leNXCZ8cPgv3PTqqUd643VkyPfRH/XGX0RN1 JHgQVQQWZrrEpvWAYvPhJh+mNyTq5o+jwHc2TTj54FGniPO1+QdaL+RsdnHARIxer3p6Y/fTVWb D2d/Dj+UxaFRqoH/1ZQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-23_04,2026-03-23_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 phishscore=0 malwarescore=0 spamscore=0 clxscore=1011 bulkscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603230123 Prepare to fix improper Mx positive error propagation in later commits by handling Mx error codes where the i3c_ccc_cmd command is allocated. The CCC DISEC to broadcast address is invoked with i3c_master_enec_disec_locked() and yields error I3C_ERROR_M2 if there are no devices active on the bus. This is expected at the bus initialization stage, where it is not known yet that there are no active devices on the bus. Add bool suppress_m2 argument to i3c_master_enec_disec_locked() and update the call site at i3c_master_bus_init() with the exact corner case to not require propagating positive Mx error codes. Other call site should not suppress the error code, for example, if a driver requests to peripheral to disable events and the transfer is not acknowledged, this is an error and should not proceed. Reviewed-by: Frank Li Reviewed-by: Adrian Hunter Signed-off-by: Jorge Marques --- drivers/i3c/master.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 1e2c086a24ac2..b80f7528948ab 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1059,7 +1059,8 @@ int i3c_master_entdaa_locked(struct i3c_master_contro= ller *master) EXPORT_SYMBOL_GPL(i3c_master_entdaa_locked); =20 static int i3c_master_enec_disec_locked(struct i3c_master_controller *mast= er, - u8 addr, bool enable, u8 evts) + u8 addr, bool enable, u8 evts, + bool suppress_m2) { struct i3c_ccc_events *events; struct i3c_ccc_cmd_dest dest; @@ -1079,6 +1080,9 @@ static int i3c_master_enec_disec_locked(struct i3c_ma= ster_controller *master, ret =3D i3c_master_send_ccc_cmd_locked(master, &cmd); i3c_ccc_cmd_dest_cleanup(&dest); =20 + if (suppress_m2 && ret && cmd.err =3D=3D I3C_ERROR_M2) + ret =3D 0; + return ret; } =20 @@ -1099,7 +1103,7 @@ static int i3c_master_enec_disec_locked(struct i3c_ma= ster_controller *master, int i3c_master_disec_locked(struct i3c_master_controller *master, u8 addr, u8 evts) { - return i3c_master_enec_disec_locked(master, addr, false, evts); + return i3c_master_enec_disec_locked(master, addr, false, evts, false); } EXPORT_SYMBOL_GPL(i3c_master_disec_locked); =20 @@ -1120,7 +1124,7 @@ EXPORT_SYMBOL_GPL(i3c_master_disec_locked); int i3c_master_enec_locked(struct i3c_master_controller *master, u8 addr, u8 evts) { - return i3c_master_enec_disec_locked(master, addr, true, evts); + return i3c_master_enec_disec_locked(master, addr, true, evts, false); } EXPORT_SYMBOL_GPL(i3c_master_enec_locked); =20 @@ -2107,11 +2111,14 @@ static int i3c_master_bus_init(struct i3c_master_co= ntroller *master) goto err_bus_cleanup; } =20 - /* Disable all slave events before starting DAA. */ - ret =3D i3c_master_disec_locked(master, I3C_BROADCAST_ADDR, - I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR | - I3C_CCC_EVENT_HJ); - if (ret && ret !=3D I3C_ERROR_M2) + /* + * Disable all slave events before starting DAA. When no active device + * is on the bus, returns Mx error code M2, this error is ignored. + */ + ret =3D i3c_master_enec_disec_locked(master, I3C_BROADCAST_ADDR, false, + I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR | + I3C_CCC_EVENT_HJ, true); + if (ret) goto err_bus_cleanup; =20 /* --=20 2.51.1 From nobody Fri Apr 3 16:03:02 2026 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 597BC3BAD85 for ; Mon, 23 Mar 2026 16:12:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282330; cv=none; b=QssMpeggsYcQXBCtx0/lDpPXLxcGZG+gfayqEjZfSg8I9OHrn5i8GK57fDHqufZ7sgJMc2/izDhls+JQHwLO3j4IKumXxLARfFUljjmUixvMwhVSiahI4SJmwFRQ/ABWbUqvg+Ti1/PoIkH3b1biRTZ7/Pk0a43lIbYGkgeUO8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282330; c=relaxed/simple; bh=mXexfWrPC8job5yxecoVQWlrK4dSj2XswWAmOWB70/A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=YPzan/kl++fmT/WiprZd7Gyy6EJpXkmC2JbaThOp6MD/3zvgqkjXkDjfOZzk88MJKNG2UJ5OSaArBElj0gnHdnW7HJyEiBo7Yt8vS4QDAwkm6NOazVvp2KxbzxU2yF3M4AvAIiaW6eJ0jd7G2eC5udj1TmItYrLS+TiF8g5m/xk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=e5F3gdH3; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="e5F3gdH3" Received: from pps.filterd (m0516787.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62NDGvve2271070; Mon, 23 Mar 2026 12:11:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=22wa1 IcvbmGWHaddNqNINTnZZckFB8o0psKJ23G1isY=; b=e5F3gdH3/IttTFGDYNz2P CjXxaCLHjRh0+aQIX/O93/spZmqTMFxWP1+H8tBotlcadnPysERTip0n3DtTKIw8 iNmLtOc6ipvBCpK+WivKsdFU9KpRxLA4C2qlhJoYr171QgWGcSxrdci2A4alzixi eqxCH8LrBMhacISgy2VypxLJEAX9ecaP4CYkb66F70vab+do/1uehDpgl+2w45Kt eCZjyYbd2nmo5Tkwn52UagF/zuCPX8LTpR+EQ6uiedqgEHpItnDOkc00wTAlqDg9 fR0cNZ5G0rnOK1TxHmTWgo2NJC8zgzH76ov9IUvwNVdX1hc7fbcTW1RSyZtYy1JS A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4d2cnew41k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Mar 2026 12:11:54 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 62NGBrdi044715 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 23 Mar 2026 12:11:53 -0400 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Mon, 23 Mar 2026 12:11:53 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Mon, 23 Mar 2026 12:11:53 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.1748.37 via Frontend Transport; Mon, 23 Mar 2026 12:11:53 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.44.3.69] (may be forged)) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 62NGBYnu019356; Mon, 23 Mar 2026 12:11:49 -0400 From: Jorge Marques Date: Mon, 23 Mar 2026 17:11:32 +0100 Subject: [PATCH v3 4/5] i3c: master: Fix error codes at send_ccc_cmd Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260323-ad4062-positive-error-fix-v3-4-30bdc68004be@analog.com> References: <20260323-ad4062-positive-error-fix-v3-0-30bdc68004be@analog.com> In-Reply-To: <20260323-ad4062-positive-error-fix-v3-0-30bdc68004be@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , "Dan Carpenter" , Jonathan Cameron , Jorge Marques , Adrian Hunter X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774282294; l=4492; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=mXexfWrPC8job5yxecoVQWlrK4dSj2XswWAmOWB70/A=; b=fG+sRnwvsADIgpFBn97TZRXbm0jfwZ8sYFYqKD4oL04ZKdbKLWswD74UU2uewSwMjZxdqwyzF fNT29XOvQrrC3YdVqta70ICe+XmOdAbkvyzbKql3BSjd0SIxD7ThTye X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=UcVciaSN c=1 sm=1 tr=0 ts=69c1664a cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=0sLvza09kfJOxVLZPwjg:22 a=OmVn7CZJonkx5R5zMQLL:22 a=VwQbUJbxAAAA:8 a=KKAkSRfTAAAA:8 a=QyXUC8HyAAAA:8 a=gAnH3GRIAAAA:8 a=hEpeh2MoHh9kNZLcwicA:9 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: GbH2A9rCJzKlv7EiEWIRPiQ9EbHjdscF X-Proofpoint-GUID: GbH2A9rCJzKlv7EiEWIRPiQ9EbHjdscF X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzIzMDEyMyBTYWx0ZWRfX2gmJz8LSsR8s bvrKr6dgx6EUhrcLWEwV9N+2PQoRSJS8Igu9/NZmiJECrXaChsl4aP+vBTmbuZ0geJITL+NuhvH cvdLiQI+ND6bwBXQoNGcsafgOe9QoCaJd7GEXmfzVatgd0HM1gj/3PT8fJaVwUZrRr/IbF3Fq2I w9OUiUC/tyC0sYmb4hdOCqCFy+B/jqkem9biBaIcCJWXdHP76wLUeFIVNjbxpOjIydc8u9GCNA2 tgXtesQinV3Sm7pgdjsqp2LSrkO21hvaz1wO3hiI+8LD6dMV9lAEMTJtCPsb86o2rdECKW3HhMY Ob7arW0suX4nn/XABMn+JXODmUSr9+FSYR9Cc/uquT2Lc65XbQBU5eWDtAJrhEXPG9tFud3n1og 2bi0HcRZ/Nqq6pml+fhnLBWO9+EZ8lkvSCSAAf4Wyh59syGXOGU1HhV9AiLp1+3db6c/0NUfTsW 6BrpSTmvYiHU6h5WDhw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-23_04,2026-03-23_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 phishscore=0 malwarescore=0 spamscore=0 clxscore=1011 bulkscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603230123 i3c_master_send_ccc_cmd_locked() would propagate cmd->err (positive, Mx codes) to the ret variable, cascading down multiple methods until reaching methods that explicitly stated they would return 0 on success or negative error code. For example, the call chain: i3c_device_enable_ibi <- i3c_dev_enable_ibi_locked <- master->ops.enable_ibi <- i3c_master_enec_locked <- i3c_master_enec_disec_locked <- i3c_master_send_ccc_cmd_locked Fix this by returning the ret value, callers can still read the cmd->err value if ret is negative. All corner cases where the Mx codes do need to be handled individually, are resolved in previous commits. Those corner cases are all scenarios when I3C_ERROR_M2 is expected and acceptable. The prerequisite patches for the fix are: i3c: master: Move rstdaa error suppression i3c: master: Move entdaa error suppression i3c: master: Move bus_init error suppression Reported-by: Dan Carpenter Closes: https://lore.kernel.org/linux-iio/aYXvT5FW0hXQwhm_@stanley.mountain/ Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure") Reviewed-by: Adrian Hunter Signed-off-by: Jorge Marques --- drivers/i3c/master.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index b80f7528948ab..e092c833124c0 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -898,11 +898,17 @@ static void i3c_ccc_cmd_init(struct i3c_ccc_cmd *cmd,= bool rnw, u8 id, cmd->err =3D I3C_ERROR_UNKNOWN; } =20 +/** + * i3c_master_send_ccc_cmd_locked() - send a CCC (Common Command Codes) + * @master: master used to send frames on the bus + * @cmd: command to send + * + * Return: 0 in case of success, or a negative error code otherwise. + * I3C Mx error codes are stored in cmd->err. + */ static int i3c_master_send_ccc_cmd_locked(struct i3c_master_controller *ma= ster, struct i3c_ccc_cmd *cmd) { - int ret; - if (!cmd || !master) return -EINVAL; =20 @@ -920,15 +926,7 @@ static int i3c_master_send_ccc_cmd_locked(struct i3c_m= aster_controller *master, !master->ops->supports_ccc_cmd(master, cmd)) return -EOPNOTSUPP; =20 - ret =3D master->ops->send_ccc_cmd(master, cmd); - if (ret) { - if (cmd->err !=3D I3C_ERROR_UNKNOWN) - return cmd->err; - - return ret; - } - - return 0; + return master->ops->send_ccc_cmd(master, cmd); } =20 static struct i2c_dev_desc * @@ -1036,8 +1034,7 @@ static int i3c_master_rstdaa_locked(struct i3c_master= _controller *master, * * This function must be called with the bus lock held in write mode. * - * Return: 0 in case of success, a positive I3C error code if the error is - * one of the official Mx error codes, and a negative error code otherwise. + * Return: 0 in case of success, or a negative error code otherwise. */ int i3c_master_entdaa_locked(struct i3c_master_controller *master) { @@ -1097,8 +1094,7 @@ static int i3c_master_enec_disec_locked(struct i3c_ma= ster_controller *master, * * This function must be called with the bus lock held in write mode. * - * Return: 0 in case of success, a positive I3C error code if the error is - * one of the official Mx error codes, and a negative error code otherwise. + * Return: 0 in case of success, or a negative error code otherwise. */ int i3c_master_disec_locked(struct i3c_master_controller *master, u8 addr, u8 evts) @@ -1118,8 +1114,7 @@ EXPORT_SYMBOL_GPL(i3c_master_disec_locked); * * This function must be called with the bus lock held in write mode. * - * Return: 0 in case of success, a positive I3C error code if the error is - * one of the official Mx error codes, and a negative error code otherwise. + * Return: 0 in case of success, or a negative error code otherwise. */ int i3c_master_enec_locked(struct i3c_master_controller *master, u8 addr, u8 evts) @@ -1144,8 +1139,7 @@ EXPORT_SYMBOL_GPL(i3c_master_enec_locked); * * This function must be called with the bus lock held in write mode. * - * Return: 0 in case of success, a positive I3C error code if the error is - * one of the official Mx error codes, and a negative error code otherwise. + * Return: 0 in case of success, or a negative error code otherwise. */ int i3c_master_defslvs_locked(struct i3c_master_controller *master) { --=20 2.51.1 From nobody Fri Apr 3 16:03:02 2026 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B90C3BBA00 for ; Mon, 23 Mar 2026 16:12:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282331; cv=none; b=qbSfRocy8Lsj6jntShVXsF0P10n9BvoQbEJX1CopvbiCHyTcYAWBNVjRy8vymCGUHHZTXsSLexVwOldtHhqmWIVBFO6jZo6L2nHp39msHAPpf/gdbw4U4A0UASEuHvaddv3fEEh2dWou9+NE+dad6PbuavJ2A/uJfXNVwi+Sp4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282331; c=relaxed/simple; bh=T44G3FpeQ67jXTuEpd994gu+9XxEQ/csi9RRiDp+9ec=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ub01a0zVV40CMbM70Asw7ZKOO23Ca+36pcmvGDu2/rehsOV+TPaZCYn5yk0zM10MeBmo+blKVSnWGGzWPwTxQatsCRKFzGjSo1xFMoLcAahh5ivYUhj+zku7BIGDSxYCk4S4SM95RPgovUA1+Fa9+ShuBU4IQWezydbgi27iQ5A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=aBGmjGmE; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="aBGmjGmE" Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62NG6xV6662623; Mon, 23 Mar 2026 12:11:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=gS8SR Pt9po2WvkI6r9W/I+1n1wFwW/teqZZo+DBfx40=; b=aBGmjGmELkYUHk1c3RsL8 buVE3L33LG2JHMTjHCMfrNU3oliPPprSPHm2W4pA0D7XBsAbBPdn49sKBK3T7X+A lGPKExwsbvB/rMaZxQJN5XSNwov9e1eqcjjf4F3EpihQO/uXLiv5DXJtQmQNe7T6 aukPGyJFjtWOj2sReEihaygpFHQjUj6Ilhn/xR0ISXmmSTLrxZZbTnxDdanui9z4 Rj7LigDbLhedk/8cmwv/ul+thBU5iZYa8QMKufV8F9d0TqqAMZY6bfrBL7ka8HZg uFdQUxQfJXgQpoJAgeo/pW4WnKBvsDz5u+hTeKFzRXxjYGU4cq+cIE6iGTYkWsHF A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4d1n620cth-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Mar 2026 12:11:55 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 62NGBshg044718 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 23 Mar 2026 12:11:54 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Mon, 23 Mar 2026 12:11:54 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.1748.37 via Frontend Transport; Mon, 23 Mar 2026 12:11:54 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.44.3.69] (may be forged)) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 62NGBYnv019356; Mon, 23 Mar 2026 12:11:50 -0400 From: Jorge Marques Date: Mon, 23 Mar 2026 17:11:33 +0100 Subject: [PATCH v3 5/5] i3c: master: adi: Fix error propagation for CCCs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260323-ad4062-positive-error-fix-v3-5-30bdc68004be@analog.com> References: <20260323-ad4062-positive-error-fix-v3-0-30bdc68004be@analog.com> In-Reply-To: <20260323-ad4062-positive-error-fix-v3-0-30bdc68004be@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , Dan Carpenter , Jonathan Cameron , Jorge Marques , Adrian Hunter X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774282294; l=1192; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=T44G3FpeQ67jXTuEpd994gu+9XxEQ/csi9RRiDp+9ec=; b=sPUo/LjRI/7lVjEBiR92N1/HJWLZYG5WhigxO7y0R2A1xCl3SYsFSFsxn4Fhu6cO+aeckjj/4 DmDb+lQ1FpVD6yeU6yit6ILwuJuZRR8h6wrWR9+QiAQRHf2aJvn27aX X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzIzMDEyMyBTYWx0ZWRfX1m56SYJ0g3AO 9BqF1sw9d8v1x5Y1PDB25ms2HJ1OAOzAkCGO+DSPhmAWmI35OYBe/Lm9+tHhI1FuiRCIC85nmJ9 ED1UYYEEAtidlF2GrjD3g2k09wAul4NnOi5Op44EXg/8Hf5iWCynYdmWFuiy2t+OGaLvQK25l4U 4OU427xWkPsDFszUgUwMQ3eIzEMm2/1gmIR5nRV19Mgg1ylQfgVt2dnKHMFxJeU41AyMA9W74Qf TIj9mejOPMtpOtvCs6PCtzBZkSN4rJQn2TAEpkbV6V/nz/xLw6ZwXUcrX1T5y54PrQ+X2d6I0a3 GsWH8ll60YmywVUdapSr7vgmByZUHC73yLTyAGm169AAXMAEWsjkpwxovkmdB3UM5kk/GQl124y VtsIR9gfpz2DWukH8BupJDkGh43IlPpMBgEI57N/+ldn8f6XpMBHv40LNjDGXaMy15bQGOuU1b7 pDxMEjP6tKrikbtwT+A== X-Proofpoint-ORIG-GUID: J4SqcB_nIMRGWSgms5JlVnCaSukrpaRK X-Proofpoint-GUID: J4SqcB_nIMRGWSgms5JlVnCaSukrpaRK X-Authority-Analysis: v=2.4 cv=D59K6/Rj c=1 sm=1 tr=0 ts=69c1664b cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=0sLvza09kfJOxVLZPwjg:22 a=uXIjobp8t2wMuQ0fPvqm:22 a=QyXUC8HyAAAA:8 a=8AirrxEcAAAA:8 a=gAnH3GRIAAAA:8 a=VNPTIpmBBdLJ-BnbUa8A:9 a=QEXdDO2ut3YA:10 a=ST-jHhOKWsTCqRlWije3:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-23_04,2026-03-23_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 adultscore=0 impostorscore=0 clxscore=1011 spamscore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603230123 adi_i3c_master_send_ccc_cmd() always returned 0, ignoring the transfer result populated in the completion path. As a consequence, CCC command errors were silently dropped, including the default -ETIMEDOUT and later overwritten by adi_i3c_master_end_xfer_locked(). Fix this by returning xfer->ret so that callers correctly receive any transfer error codes. Fixes: a79ac2cdc91d ("i3c: master: Add driver for Analog Devices I3C Contro= ller IP") Reviewed-by: Adrian Hunter Reviewed-by: Frank Li Signed-off-by: Jorge Marques --- drivers/i3c/master/adi-i3c-master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i3c/master/adi-i3c-master.c b/drivers/i3c/master/adi-i= 3c-master.c index fb9a488304469..047081c9f0643 100644 --- a/drivers/i3c/master/adi-i3c-master.c +++ b/drivers/i3c/master/adi-i3c-master.c @@ -361,7 +361,7 @@ static int adi_i3c_master_send_ccc_cmd(struct i3c_maste= r_controller *m, =20 cmd->err =3D adi_i3c_cmd_get_err(&xfer->cmds[0]); =20 - return 0; + return xfer->ret; } =20 static int adi_i3c_master_i3c_xfers(struct i3c_dev_desc *dev, --=20 2.51.1