From nobody Tue Apr 7 14:39:36 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 282A939022C for ; Thu, 12 Mar 2026 16:38:46 +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=1773333527; cv=none; b=eMBihnfLmVnSOanxSJBh+TI3Q1MSIj/hLv+iYcsEH+ySoVu8a2KOwfj4f7EyBCFeJlSYJLXB+9jAvvujxF4+GZassfE56UIvAXjL6KJ/cVmYO1JBLzCGFBIM5dtWh/+XTtHhQuAvf26ysHIrQdvnft1H3ciXnNg/Q7r7E7tLxy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773333527; c=relaxed/simple; bh=k5d2D92jeaLhYWwICwnl31VS8E518jAAEp+IOyu6hgM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=eVaJqT/sU81nDig5a+WYq1Bf7YdmqMZmZL7j2kDGv4gpIRNSuxYmVC05evMstPbfLXekwlLF697FoApm3ra9g7NFBFEhk7EvXCRrBdYsGPOYL3gL4co0MPzvZoa+u3PoSJt74ypP4hfUGBdbytmV/1tASqJZMjgNRuCjP7jWMeY= 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=u8cB8ylx; 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="u8cB8ylx" 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 62CB2f5m1999727; Thu, 12 Mar 2026 12:38:27 -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=dPvUL CIUekonudW8rZUau6fSmrfsOpqPfpx/auhxynM=; b=u8cB8ylxrtQg1/vVtxdP2 6g0Mmafwo1zUvUyOIOH6DB4fl3Ju9KLlNA3HvXLSwcQSXbQdhiiN4AAOKPxKE2AL XF+y/aRNeKosq3KjRRDA4QLsldaWYmUKB/iEI+jG/Hz6l4unPjW1K4XDsVd/PSoS 2whSBy4W/DmYQCJbv4u1XDRRZL81SlXGNyKntPm1sF9czYps0sOiK9m0hFZnK+ad jmnmm9Dxj+FSE8J8qoU+UmePBW5KPVYvmcP8fTC4LRbuAzTLjxXY93AdMPD+nc9N ruqGIO9uQm9THfJOIqrpGWo+t6MxdM9j8z2ZibZcyldDLR5cqi4wdk9LwU00eHIi g== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4cuh5wkdqd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Mar 2026 12:38:27 -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 62CGcQak009191 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Mar 2026 12:38:26 -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; Thu, 12 Mar 2026 12:38:25 -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; Thu, 12 Mar 2026 12:38:25 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.44.3.82] (may be forged)) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 62CGc8GY021063; Thu, 12 Mar 2026 12:38:18 -0400 From: Jorge Marques Date: Thu, 12 Mar 2026 17:38:04 +0100 Subject: [PATCH v2 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: <20260312-ad4062-positive-error-fix-v2-1-1c933b5c7ed8@analog.com> References: <20260312-ad4062-positive-error-fix-v2-0-1c933b5c7ed8@analog.com> In-Reply-To: <20260312-ad4062-positive-error-fix-v2-0-1c933b5c7ed8@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , Dan Carpenter , Jonathan Cameron , Jorge Marques X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773333488; l=1617; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=k5d2D92jeaLhYWwICwnl31VS8E518jAAEp+IOyu6hgM=; b=9dF8oVRn6wzSHTCElJaG87piYIiBZzxjyzDu/aavhb8BPFJDXrwey9ZcBdBAzsnV/fX0iA+vE zxMPrK6NBx/CEHWKsKxab9EgITPcQI3r/+G0G3l9Nf3iWLVPzaUhZ88 X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEyMDEzNCBTYWx0ZWRfX4PbCcdm1SkVL kHMpv7yxR95fdGOSXoJJNKvqBFa/NGZGCgEH+9oinTAqov2g00C9/pdE2FIQRMlJuso71IM5a4H EdaCXHgn+qU7lK8E/TqEsUwOjVOp2bpdmArZWDstVbkEctGcM9pv0CedZ1dUL6r2l+Kgc68TCVu DJDuelNwAolh8MZ/dUbnpHQlY8hX8OHDP5FHsPlrrIBVvV1kqTHTpQg4+bSL7cZCw2e9jVX6q7n P/MI+ubU7N52x8+2AW5aGRGKsK9KPCStkrw3ZD8jnYK3ew2aot6Sg6gkkarebpPWopTYaB/6grI PdC8T/qSw0KuLQBeUO7vVD9s08IbLjmd3/ijw3Cyae7ng+KMWVHrCGOUgBsd586J8OiIjhOLeB3 N+bSb0zWM7maz1VytyfAjVDlq+Xw2RB3e0XxD29Ztloi4QMCzu+WinXzy+2HJezuxuRy+inFiLs xe1bJBtZCa7s6jyGZtg== X-Proofpoint-ORIG-GUID: bGf4YKQ2bNpnjLU6i7FzPkNQWBrPyEjQ X-Proofpoint-GUID: bGf4YKQ2bNpnjLU6i7FzPkNQWBrPyEjQ X-Authority-Analysis: v=2.4 cv=K+Qv3iWI c=1 sm=1 tr=0 ts=69b2ec03 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=gAnH3GRIAAAA:8 a=jGnnJhjHKBc1zkP0xQgA:9 a=QEXdDO2ut3YA:10 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-12_02,2026-03-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 clxscore=1015 spamscore=0 impostorscore=0 adultscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603120134 Prepares 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. Signed-off-by: Jorge Marques Reviewed-by: Adrian Hunter Reviewed-by: Frank Li --- drivers/i3c/master.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 9e6be49bebb2c..c66f2655eb404 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 @@ -1796,8 +1800,6 @@ int i3c_master_do_daa_ext(struct i3c_master_controlle= r *master, bool rstdaa) =20 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); @@ -2093,7 +2095,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 Tue Apr 7 14:39:36 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 6542B391828 for ; Thu, 12 Mar 2026 16:38:47 +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=1773333528; cv=none; b=DywLJk7iiKjOSfS/4awkloPHyUAQU+1dsk0GYVEyQQbIY0cmQ1ZiqG6AO64IdXZPbdIe42bOa99YZKV/yEYNmQ7M54B15k/dJSVQ77Ci8acZ6AO+8iJN11OFADtlhAazAL/LvO2BduWAlPpQWr18Wdt/GoYCYxTxhZRmjaVYc6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773333528; c=relaxed/simple; bh=hG2W/aFtJxekjzsBKdzkHHLs+V6Bq3L3amu7nbgetjg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=IXrazNkyr85Jptr7BtJX6Wm3gNDSYY0HuTWTKnFyAWeik6fmpoC84RoJjVvm11pAlQ9cLdiqDv8aPKrqRbW8as71tm+sr/YesVyP5IKS2ECamEYM554E3EWpGQ4UxGjKiTCXc5gqtcxwVMCGidglt9Ux4IiB4Z3nm44kBBDL89g= 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=w+iugGLs; 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="w+iugGLs" 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 62CGGOUs030689; Thu, 12 Mar 2026 12:38:26 -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=y+BT6 TAuklgJXAUP/fDRc1GEidKMvj7bQXggoi5xqto=; b=w+iugGLsLce04v5JO5xQn JHeYvQZhPjATzFgO1AnwkIKzpVJPFFD7uMGjVNO3PmpmoGrdF5ne2GlGm3901ZIZ cizvnAWzRaPVvp22WlQ4Dw5C22ZAXRvWqR2WVUQPrN/vpM2GkfTnNtvNFDKmWka4 68UUZZYc9d3mXHx3iJkUjKyT2P+ZtiNnY7VoTb61LtAWhqc2ylv9gAwcKp+jkCy3 hV4wDlk3Ssoj0Pq47JUj+ji46LY8S92nUifk81UHV1g+4S4nYleQ8EDXnLpdS+k/ HVWVnmOyeFuTWVF6ojzuzdi29sQuGCO9SdnG0HrsCKQR/ekSt94uUvemqX/d++lA g== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4cuh763ehd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Mar 2026 12:38:26 -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 62CGcPxV009188 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Mar 2026 12:38:25 -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; Thu, 12 Mar 2026 12:38:25 -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; Thu, 12 Mar 2026 12:38:25 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.44.3.82] (may be forged)) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 62CGc8GZ021063; Thu, 12 Mar 2026 12:38:19 -0400 From: Jorge Marques Date: Thu, 12 Mar 2026 17:38:05 +0100 Subject: [PATCH v2 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: <20260312-ad4062-positive-error-fix-v2-2-1c933b5c7ed8@analog.com> References: <20260312-ad4062-positive-error-fix-v2-0-1c933b5c7ed8@analog.com> In-Reply-To: <20260312-ad4062-positive-error-fix-v2-0-1c933b5c7ed8@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , Dan Carpenter , Jonathan Cameron , Jorge Marques X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773333488; l=2374; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=hG2W/aFtJxekjzsBKdzkHHLs+V6Bq3L3amu7nbgetjg=; b=mASspbZmJfa283vsiPI97kggqxqBC7pLF/qoiWfXtKp/gG+cfKb0sHjhQxZXPPLz7yYHnaanT HXsDavPr/mCALSXpQSWbLiUIReXlUednEM6X60dkh+6db8Ni5SCa+0l X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: VwMxFwmhvvQP9WLznFsvgFqdy8GmAt0y X-Authority-Analysis: v=2.4 cv=AI0/m/Lt c=1 sm=1 tr=0 ts=69b2ec02 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=gAnH3GRIAAAA:8 a=lW4FyyzJGg7ItnWL1goA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: VwMxFwmhvvQP9WLznFsvgFqdy8GmAt0y X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEyMDEzNCBTYWx0ZWRfX8XEjzBe5/wyF Gn+mRRH/QJAvLxcxSz7KBDB9jUFV0KHQVdGv7AWbmIbfEFYqAe/wWarQVwY4hORQ+Df3D9wpKP2 Z8djefGnaQf/gTzsu//6D0O+vWFqiJZ98rxLnTAqi5q0Uq0dgJrg5n7zlxF0Vy7Fd3TxMK1GvWb 0/J4oCGW5bjdhpzG2SLTrI7FA2wIW3dMuT3CIJbo/R3s7nLfUqvCzi9/ethqQeC7DkU2B/xwIdY bN69lZKi7Vq8TYmmoNmpQOKFY/tXs3O8/gQgK+neKlXjAUc7+s8iLv5+gTVyX0WB7Dp5PJlxgc1 3BFQSHX651tmswzWx9lEeMHgDffB//cUB7Iv2UoDQpgI0AHEfKR/cfCYOWxXtEORAbGme7f7aiC L0WEh1HiUML7gfnpTZI4pFwZnsJMvbXH/Yd8FzWzocmqDh1xLKoOfZlZezOSsbvP4qBnEZo5Hoa qPum82xymHrvygBaXQw== 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-12_02,2026-03-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 impostorscore=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603120134 Prepares 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(). Signed-off-by: Jorge Marques Reviewed-by: Adrian Hunter Reviewed-by: Frank Li --- 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 c66f2655eb404..d4f9e7df4adc5 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 Tue Apr 7 14:39:36 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 D5205390992 for ; Thu, 12 Mar 2026 16:38:46 +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=1773333528; cv=none; b=epTjSSkciuAGYnheg9Nb1EslY4f7iYJBziIEgwy5vs5T1H8DpeqQBSyiT+ynl+SmyZoROiSgGnRNBtNVjRtcnTYlbbQ+bqTfnuatONj6dw3qQq+GYbeYKYSgZkOi1gZ2ca0txUNi3Yfa3dQRmiPikGbxThyTLg3hWgiOFqBk4gE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773333528; c=relaxed/simple; bh=QPiJT+SgAegv8Qe7r5mUnpu3bTWGbjpMxw9UXCHYdCA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=MGWg8rMTAOZK8aDfXdcoNRD81HfbeXGmqEHLNcXkGY+9rglfysmRYObBI5sVVMqdgwYgU5JMCoEQAzjCmt+gitTbtNlrkR2Efic0Nb6C2WSIHK8ZciHml+o4tS05daj7RWyG+DyBjJ5/8P/IVPB2V3WMqLUov1UqAFhmM/9mpmc= 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=HIIX3/qQ; 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="HIIX3/qQ" 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 62CGTwih030488; Thu, 12 Mar 2026 12:38:29 -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=VYEti fmAA6GoQD66rFpZEOS/mBJCrNQ5cDAhNFtM21w=; b=HIIX3/qQN5k1KACG9o8+c j1ZKL/U1RjJMvmm6JuF95JzDSOrXJ+0kgINP+UxNDr6sylPOYD0nvFlz9GHGo29i 5vwFDRpWLK0fc6UWyAy3Db6esGgnpQ6H1/IeXBCLPimDweM978EdmxfUyoMLzoqk xhevwbjzg4VzL+dKPincqg7Avd/Vz83KDntP9kjnbt5aoqdemwd3cSzrxvy80pVd Cbiry0Bej038YtA9x8KvcJS0Cc0FoD7ZUqAXiTw/ZL9hespP7t0TjmBoqQzstgCS +tiKtBQ8RQ7gYXXgsuj232QKVqr3RhvrF8/0BY5mHgg/9GyiXZvWxJe22+zSLjSH A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4cuh763ehj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Mar 2026 12:38:29 -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 62CGcSGe009200 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Mar 2026 12:38:28 -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; Thu, 12 Mar 2026 12:38:27 -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; Thu, 12 Mar 2026 12:38:27 -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; Thu, 12 Mar 2026 12:38:27 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.44.3.82] (may be forged)) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 62CGc8Ga021063; Thu, 12 Mar 2026 12:38:20 -0400 From: Jorge Marques Date: Thu, 12 Mar 2026 17:38:06 +0100 Subject: [PATCH v2 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: <20260312-ad4062-positive-error-fix-v2-3-1c933b5c7ed8@analog.com> References: <20260312-ad4062-positive-error-fix-v2-0-1c933b5c7ed8@analog.com> In-Reply-To: <20260312-ad4062-positive-error-fix-v2-0-1c933b5c7ed8@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , "Dan Carpenter" , Jonathan Cameron , Jorge Marques X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773333488; l=3314; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=QPiJT+SgAegv8Qe7r5mUnpu3bTWGbjpMxw9UXCHYdCA=; b=ELKvG3UjOkirSINK19PX1o2qAu9RjO5Mesyq2PMFRtM5zfdysaBr4WCebMQu7k3T6/8kc37n9 Uhr43dUhJ2RBQ874detbYbbuROXhiZNU0LdKJfLZUnHdjxOE1t1GBTb X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: LczxGJtppHUXjC0dIEo8YxZ1xDz3xbV5 X-Authority-Analysis: v=2.4 cv=AI0/m/Lt c=1 sm=1 tr=0 ts=69b2ec05 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=gAnH3GRIAAAA:8 a=dlK5iWcZi1ZAZcL_4pgA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: LczxGJtppHUXjC0dIEo8YxZ1xDz3xbV5 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEyMDEzNCBTYWx0ZWRfX2XED03rC4Zy7 2UQi0DhnXgPYhw2SKG1fwpji5BQhecJS5tzf0Jq6Jo08jUjP7YDPdk8DhCgCQFr8nSaEdY8g4ug Cxcr6NW6M5CaU53eFrW78ZQuTlLwP4+Cc61EyFn5418+43V0ZXE3/9hbtMM/F+tzkbTCFfTsSOj IQggM0ylHid8x46WdWwAUFiakAN8mI/tSIqr02QNgsAUTVmAGr6WaVu7AGW85vOSzly480UbA44 UNkmZTnfQvR4RnEdQ3/CjL1vRXpVQA7QLt1QI0jy2s0Tm0fDG2LuESqlK6rxu7w4d6qVPhGvGMR dd0EXMHqmVnV0dn27Tida44g1btLq9oZMefbfK6C9JfGK79GgyVtUkPuZmWseNaQFzF7buNBjJR ruIj/kRh/1qiBBIcGfLk7ragWVQBGPGLcsTnq63+geHfum69ZBjoUqZ/wWOsP9taT8JS0/zE/VD tadoYY+v2sQ8kcLtb3g== 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-12_02,2026-03-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 impostorscore=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603120134 Prepares 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. Signed-off-by: Jorge Marques Reviewed-by: Adrian Hunter Reviewed-by: Frank Li --- 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 d4f9e7df4adc5..bc1189afaed81 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 @@ -2108,11 +2112,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 Tue Apr 7 14:39:36 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 F32EF390CAE for ; Thu, 12 Mar 2026 16:38:47 +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=1773333529; cv=none; b=UvXD4Z9riUneNhe49oGOx+tU1bQD19VFsQATToAaIWNceyNRTkUoBmmxvPoAZdh6HXrCYdLFkY2gSMBKHvZE1EIcTlgDXHI/+rhPym2MwfhJxMopnP0xOdarrM75HGjRZ00Bu/WippyFGYDAfD4i9VAcnuvtXnLVixF1/1artg8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773333529; c=relaxed/simple; bh=7vidzCQRmOyF2S3K2XJ89yaex63i+B/REByOo+UC1YE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=mLJj/jfwJZ3/AMMcPyde8Zuvxked/8kmTBwjnHyhbk3QWp/p7AMRB4xhNeA19cKd4XkvZx9tC5GtAFHBHgCi2LNS1w2EJHAWlUqnKZ2u+Rqulv5koNAT451CigBpdnlVKSTCtXLZpcgOC+MWIfIBDoNpgPt58ivtXZnshgxX7FA= 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=OG564ueb; 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="OG564ueb" 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 62CFOdmt3650594; Thu, 12 Mar 2026 12:38:28 -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=tUSKW QT4P/2moqhSnLHNwh/ADK0S/UpU5K7j/Irbgjo=; b=OG564uebqd2VsqJH2LfSp Fym6X1N7A9xrby6g7GmCBclpZfGF3FT6tYHzowxZwiN/9tUwtw3DlkkV40jD7bvZ n6pNZM+ksUK/tuQjAE4M8vip2qwG3w9ro9JlO7py/NdRnPS/OL+RpyQkhsCSQ7Ms G2elQp+DavTE23x2gFg1qUJh7WZdcbJ5yySNqf25Wtp+24bwO9aOFaQ2FHtVzwFs AoJ7nIU8RzdKS/uAgemNw5eKjXScMeIk614v3NVxCMRddwEJRikl/ifMxJOWxwL7 AsI6o2wz8dlHxbWCLeD0zjUM9LupFvHQTDBmgeV6u9zkMPEsZeAPdRV5kQlPM3CK A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 4cuh6bbhtn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Mar 2026 12:38:28 -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 62CGcRwP009197 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Mar 2026 12:38:27 -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; Thu, 12 Mar 2026 12:38:27 -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; Thu, 12 Mar 2026 12:38:27 -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; Thu, 12 Mar 2026 12:38:27 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.44.3.82] (may be forged)) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 62CGc8Gb021063; Thu, 12 Mar 2026 12:38:21 -0400 From: Jorge Marques Date: Thu, 12 Mar 2026 17:38:07 +0100 Subject: [PATCH v2 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: <20260312-ad4062-positive-error-fix-v2-4-1c933b5c7ed8@analog.com> References: <20260312-ad4062-positive-error-fix-v2-0-1c933b5c7ed8@analog.com> In-Reply-To: <20260312-ad4062-positive-error-fix-v2-0-1c933b5c7ed8@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , "Dan Carpenter" , Jonathan Cameron , Jorge Marques X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773333488; l=4251; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=7vidzCQRmOyF2S3K2XJ89yaex63i+B/REByOo+UC1YE=; b=F58At7aMBD89byi/0YksE/4VQU+dhMCRvGs+fZ9xppQ2X/BsDSkqr7LpnM9bKtP4/fzZkUY97 /qjKJND1/J8BGE5mvxhpLdAr355vBsedZalBUUnQdOX71RVpa0k1PSE X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: kO66H4wGjzktiawqbgh4AGHN31I6g8Na X-Authority-Analysis: v=2.4 cv=c6amgB9l c=1 sm=1 tr=0 ts=69b2ec04 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=VwQbUJbxAAAA:8 a=KKAkSRfTAAAA:8 a=gAnH3GRIAAAA:8 a=gG0kfVGoOCJ2PuLymYQA:9 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: kO66H4wGjzktiawqbgh4AGHN31I6g8Na X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEyMDEzNCBTYWx0ZWRfX3QK53iDyT1i0 qmAG7piQQnOrc7lkfm83Ry09w67KJBn6UyRGI2JH2FPMsx7IsJNeMD5VTx/g1kadudt0Vc/+tCO c7KJPQMEZmFg/+/D9o1Jqyo+5PE89lBS1/MFVmP5ORMTWnabG+epDGKVM8tMyCZRiuOKPUEEQZ3 7EfYzmAoUVCBG62pQEdEAnD3DNzv/pqSg8rVfaaQFbzlavcFQAkc6yg5DjGwtHW3wUqgVxf82fB C3L4lSUl8OKEAdpEFzKusHuz99Pg97NGK+FiF8M92b3whtRp6Oh1Y8y/o8hQ5VMavKehcmRzfRA 82XG9qmJgXP/KlZ6fK5e0YELQR5HHYXUl9WqVeMazz6+3hwLjx48MmjyoBzn+XVF6pGvOCrWwWi Qo/8HpCbsaG6n0vVUSU4j2N80kxhx41Bzq5VlpE5d6PSoEBUzhQ+l55S108VkFbl18sZnSBorDl CnZayq21LlAc83kIWGg== 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-12_02,2026-03-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 spamscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603120134 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. Reported-by: Dan Carpenter Closes: https://lore.kernel.org/linux-iio/aYXvT5FW0hXQwhm_@stanley.mountain/ Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure") Signed-off-by: Jorge Marques Reviewed-by: Adrian Hunter --- 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 bc1189afaed81..0752af5eb79b0 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 Tue Apr 7 14:39:36 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 8EB183FB06D for ; Thu, 12 Mar 2026 16:38:49 +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=1773333530; cv=none; b=BWmzHfTa+rZspy9g1+LgmJfvcPj8XNLquCIt/MEUaaQkzg2+SKNQs9iCmB8vj/Z4JUh/rRyLEuNovTgHfqkeB8CoPhsFKrAftddpIeqMOuQHMIGG8H+zGW0Rj9fdpa6zet/Wnrukpfg9a3JsunkpSQy0t2XQWo+DJZKA4IX836Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773333530; c=relaxed/simple; bh=qEFyTt1s5nJZMUCvr3Lag+e/OgjP4gX0IckUJ4wTtR0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=mjQUUN5etvQgt2kfrVy0BZDq6+G4Xiv1pzl4SaGm/5aP/h+dpp7Y/gHw7K160Y7xQsF2J3yydn0gINLUiMzXME8YImhMGiK4NBCCGYFW1KJQirWjHArmWqTvooUtlrV6qyNWK9LFz5XTaBEhgthtc12BnyudadHrD1km93FG4oY= 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=qmnzVjtF; 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="qmnzVjtF" 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 62CGUQNm3650902; Thu, 12 Mar 2026 12:38:29 -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=9BAzV jlyOIht2AO3dGsg7xUVnZURb2lN/HKsxfjg3cY=; b=qmnzVjtFVkD50KLt61K+i OT+PwzaXlL4LhXDftUlNhcx/PekpvnUPCXMo3afUt2qWYvCmwOnbQllrjyzUgy20 Pgywg3Z+34y7HJ8s/zWPJvshVNP34322dG9duzk3LhAxbMQQk/EBcADHrEHekAKL XdlR5c//vOW3RZY9MqhM/i2ofP1z45mfK4UX3NONQ2ZTKNOPTPFE5QWmvdcjjPjx ayLrARDKFMD+lGzkmsJwaa08YgMrh405TQ8aVeO3gA1QEYt8Nzi4e9eLFvjBGX4W Mcrpq50ZCoQNbsSeyOjjKZeOWtTpAYTqhw4ZXIBR8GSD2kXBm775/LHNQZpzStSj A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 4cuh6bbhtp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Mar 2026 12:38:29 -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 62CGcSGf009200 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Mar 2026 12:38:28 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) 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; Thu, 12 Mar 2026 12:38:27 -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; Thu, 12 Mar 2026 12:38:27 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.44.3.82] (may be forged)) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 62CGc8Gc021063; Thu, 12 Mar 2026 12:38:22 -0400 From: Jorge Marques Date: Thu, 12 Mar 2026 17:38:08 +0100 Subject: [PATCH v2 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: <20260312-ad4062-positive-error-fix-v2-5-1c933b5c7ed8@analog.com> References: <20260312-ad4062-positive-error-fix-v2-0-1c933b5c7ed8@analog.com> In-Reply-To: <20260312-ad4062-positive-error-fix-v2-0-1c933b5c7ed8@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , Dan Carpenter , Jonathan Cameron , Jorge Marques X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773333488; l=1096; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=qEFyTt1s5nJZMUCvr3Lag+e/OgjP4gX0IckUJ4wTtR0=; b=8+oDOltklseTgRmNd/iTQ53Wp/iKwe9BINooYOg0NAIhPyPOk6Yc1SsReo+npBL/E5cdTTzp6 58jyMJFml4rDzHXwnDQgvXPRdwBtDYHgoFCm0Jpldsyzp0uToQ2UD73 X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: upVA2Nl15sm7Dr9DFm547bemW83Ul9GC X-Authority-Analysis: v=2.4 cv=c6amgB9l c=1 sm=1 tr=0 ts=69b2ec05 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=gAnH3GRIAAAA:8 a=xdR8xYJEzGsg0H7vZJUA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: upVA2Nl15sm7Dr9DFm547bemW83Ul9GC X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEyMDEzNCBTYWx0ZWRfX96NXpV8U8M/6 F+eWJT+Q7TdH4KNghUmWdNq9WXdVh03WkfY7o6h8moQYHkp9Nz5aT0Rh2/r3W1IiTIIIeCoOpQX DelQtl01ciaIgmP+x/Zdc6E5v/Iw4zQE9AzeUU867rveeXRRMOWJIkuu2gyBMpsDpsWWM12Es8V 1bmaCHGYg1IUXwl9BML57V7WMDxi3zZsSCCfiExav+WubX+FJXex2yKCVMeb6M4HhppiL52VoqC 4oMz91cTiKPrME2QIt7ihYBBNki8kcGKW/vTM5GrvlkuumUWWUyR5IVmGdWUwC7bZfpn1anHhyd b6bk6DQjeZCs/PUiOnB1e6V5Y+LaCxNwzIIpU4a/giOBBNnlL0O+m6yukSrpMb2DfSlC/eIma9B 9FhdH1sSi7OMRT0kGumt+fjnFR3wiCRykPUqs62Cq3PR/p2zsuX0hw796wOtdHlxkmjUn1fiUfo fayRfZ1HDLWxPyguMKw== 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-12_02,2026-03-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 spamscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603120134 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") Signed-off-by: Jorge Marques Reviewed-by: Adrian Hunter Reviewed-by: Frank Li --- 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