From nobody Thu Apr 9 13:33: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 3FA1534752D for ; Sun, 8 Mar 2026 16:48:28 +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=1772988509; cv=none; b=qFA4KROL6zBiqSx4T2kyKdeneGslUKjQUMpfVbid6DRA0YGPZYWjU2MUbC6FFNJUGpzzBs4j5Ijwb0K6fphe3ELggMiEdMEGxKqR51KgourPD1GTZMTVQnpsRGu0hJO/m1vEZMn0HxxhxG/3syENVIWLhfUbbl9AZSqC68hG6F0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772988509; c=relaxed/simple; bh=iZqbAB8vQJc6jYNYm63ig2FgFSYo/VrNnkWYc1yocMM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=e8q1yN1N3JPfZiGmc021h2XM/VxmrVH8OoNGCyDmv3NqnW3fKA5ts/9tIDAKELrBb1v2sVDGdPHjm369PBNw5PCftTV4bleyCSDIru+jSftL/fN20nmJxsGxlOYHp7YvZOq0Gmdnb/5BdwI5VraY9POgC15ppqDW+6GDNPAyHqg= 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=gDXBDewo; 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="gDXBDewo" 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 62888aLK1053727; Sun, 8 Mar 2026 12:48:06 -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=3KoQN 979Q6kZk0irPLPa48rMvhLR23Dw11z6msngWIw=; b=gDXBDewouNIdiyPf7lfP8 IVVOjVYGgVGDeLDkP4/9gNSa2E7g6B4yiT99iG8+Oq28TRViNT4B4LNBa9B/isFU 72JxvLGHDatFDbHQHLu9ioAdkiaHHUpC3xbY/N3UAb1ooPxk6jrFy5YtT31J3YiT hpUDD5ScbOEKRB3EQ+oRLqyVejp2PfKuB+Pa9CI0Yb0JA9hof7DAX1fRlctZ9VxH VeMNYxSoeVNIW1h8TwSYKu0QUKgsuAMPasw/4XO+FHRb6xR2bV/doxGNB2NjVVEn REE6naWxqeXVHGixkWzBmKtsO1j7pY7rAtWnYVEWyWWlLOxlk2Rfn8dKud2RlsgE A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4cs5bfrxce-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 08 Mar 2026 12:48:06 -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 628Gm5Ia014363 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 8 Mar 2026 12:48:05 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) 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; Sun, 8 Mar 2026 12:48:04 -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; Sun, 8 Mar 2026 12:48:04 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com ([10.66.6.192]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 628GlhfH003692; Sun, 8 Mar 2026 12:47:57 -0400 From: Jorge Marques Date: Sun, 8 Mar 2026 17:47:37 +0100 Subject: [PATCH 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: <20260308-ad4062-positive-error-fix-v1-1-72d3c5290b4a@analog.com> References: <20260308-ad4062-positive-error-fix-v1-0-72d3c5290b4a@analog.com> In-Reply-To: <20260308-ad4062-positive-error-fix-v1-0-72d3c5290b4a@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=1772988463; l=2069; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=iZqbAB8vQJc6jYNYm63ig2FgFSYo/VrNnkWYc1yocMM=; b=a+u6kwMFHAGIx0Eakzy+DPtUWhX6JVIig4ZiXBI9AAT8CKR50i4Vr7dljXXuF4TjqEqlDLwRE uouc+BgEErwC7tXgIcZxiQbOiP+1FMij0Hhvpqg6iqHCjqF1T2bcVGl X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=IP4PywvG c=1 sm=1 tr=0 ts=69ada846 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=gAnH3GRIAAAA:8 a=fgiNLFeR1Srqv8pP4VQA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-ORIG-GUID: bLLq7ZkwYlDiZQx2v_9iZYNGpLaTIJPj X-Proofpoint-GUID: bLLq7ZkwYlDiZQx2v_9iZYNGpLaTIJPj X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA4MDE1NCBTYWx0ZWRfX/zgi9MoJkvUT k82qpj0uffA+Q6NOLEq70iFZNVX6ZsJwjE+V5oqJM5qgwjrw2HQvJQInTVbZS2wvFv9j9BEPw5x ATLG+VA7Hr3ShizClDd93C26gVU13yGBMx+x50cMqEGQaP0IQ2PgUwKoH4YqTUuZRrHq+vi7bJ0 iOLNUpNw4qBGzaUcWYZANP/46ie0hwFruYFXVtjcnWfqK3qhuQi7ZPMyyP31dRN0foaAdLZI0S4 5wWt1izXjQTjyT1Z5fWk3DX3IYzRLP5z1qpRBXjwv7XgJiIZDm8u7/wb90XKhHi72/NcPNaRsFk 3/vb8MucYC5on7tAsqWqPW/HnRkJSivoCbDztZnp0xwmduIKkqFAsEYNXocv0hq+HzeB07qvMNV GRf8YIoHyWDurXjG+javBJoY33027ZV9Tq9KnEHni8UCGCsVHK8o25WXycWHu/mxIPiup7gVRm6 prn6cCiPzNpJB57QGTQ== 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-08_04,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1011 malwarescore=0 adultscore=0 spamscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603080154 The CCC RSTDAA is invoked with i3c_master_rstdaa_locked even if there are no devices active on the bus, resulting in error I3C_ERROR_M2. Handle inside i3c_master_rstdaa_locked, checking cmd->err directly. Signed-off-by: Jorge Marques --- drivers/i3c/master.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 9e6be49bebb2..31822fd5ffde 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 @@ -1785,7 +1789,6 @@ i3c_master_register_new_i3c_devs(struct i3c_master_co= ntroller *master) */ int i3c_master_do_daa_ext(struct i3c_master_controller *master, bool rstda= a) { - int rstret =3D 0; int ret; =20 ret =3D i3c_master_rpm_get(master); @@ -1795,9 +1798,9 @@ int i3c_master_do_daa_ext(struct i3c_master_controlle= r *master, bool rstdaa) i3c_bus_maintenance_lock(&master->bus); =20 if (rstdaa) { - rstret =3D i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR); - if (rstret =3D=3D I3C_ERROR_M2) - rstret =3D 0; + ret =3D i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR); + if (ret) + goto out; } =20 ret =3D master->ops->do_daa(master); @@ -1813,7 +1816,7 @@ int i3c_master_do_daa_ext(struct i3c_master_controlle= r *master, bool rstdaa) out: i3c_master_rpm_put(master); =20 - return rstret ?: ret; + return ret; } EXPORT_SYMBOL_GPL(i3c_master_do_daa_ext); =20 @@ -2093,7 +2096,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 Thu Apr 9 13:33: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 8F21F347BD1 for ; Sun, 8 Mar 2026 16:48:29 +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=1772988511; cv=none; b=HkvPnhsCyLmSWwKN2S4b5RartWwh1UZnIcaOND/Dubkxhv/0aqbuawRHe600vHYKKf46+xDyG6tGvzcYQ+N63A2xp413uLvl9OPuJkAQhj6udxLalQkmEQe5FQ6XztzkvQjQtAL37qFG4lYJwIl53WbgNuIAT8sqXXpXXCxgdbM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772988511; c=relaxed/simple; bh=a2fiGLM+TNe5A3fLKFAw7ud2HzEN8cpKELAilI/NfFs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=qDx8fQq6vbrZ94qP4F6wM50U5qypP4PiIzYTGDxenZ4y365R3Cwgtd1MI6ae1dKktacA4lgzi4l/FfoTZOCHZpssz7Uhz+Ze4IrSSbzhm9sEPuScCAkkuEio5qeqYWo3eJWofqs9aWKICibOLA4jLgdbMQ3XRbafgfc/XLvH77Y= 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=zoi4huo4; 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="zoi4huo4" 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 62888qfq1054260; Sun, 8 Mar 2026 12:48:08 -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=YzbEr bGlG1X7NE+1BnwRfu5R+zLyJ7dRC3l7oI+HvCg=; b=zoi4huo4xqzamM/z4PhyQ 02w5gpfHw+rfe6I8ohn7uwaB9fBAX0xpuSm9JOSQs+Tf8aU55/yxcHcgOik09u5+ v3RZqhObyAiOWwbteQSuVRVgVH1NSrBosJHoUh0zAO6S0hGlZiBTRB00lK+KPsJH FH6CAZNIBGxJ/8n6fdi0dIER6pdCw5zO/pHlo63rcFx3jwVtNFpXzTUPilwBIl16 +UeMZxMwWbVe4tt5f+SplOOlj/E3RKjuSZDNu95/Jv4qjga/CSqxxtqfnlV40azJ M7Qqv1OhJ2O+uc7YfARuc/w6gYx2vU8xH948qS5HlYSE9CPhugrp0VpFnlcS2HyR g== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4cs5bfrxcf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 08 Mar 2026 12:48:07 -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 628Gm6jU014366 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 8 Mar 2026 12:48:06 -0400 Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) 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; Sun, 8 Mar 2026 12:48:06 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBCASHYB5.ad.analog.com (10.64.17.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Sun, 8 Mar 2026 12:48:06 -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; Sun, 8 Mar 2026 12:48:06 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com ([10.66.6.192]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 628GlhfI003692; Sun, 8 Mar 2026 12:47:58 -0400 From: Jorge Marques Date: Sun, 8 Mar 2026 17:47:38 +0100 Subject: [PATCH 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: <20260308-ad4062-positive-error-fix-v1-2-72d3c5290b4a@analog.com> References: <20260308-ad4062-positive-error-fix-v1-0-72d3c5290b4a@analog.com> In-Reply-To: <20260308-ad4062-positive-error-fix-v1-0-72d3c5290b4a@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=1772988463; l=2624; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=a2fiGLM+TNe5A3fLKFAw7ud2HzEN8cpKELAilI/NfFs=; b=Ms5dA0Vq/AHivOSkMsxj/P+dHb/jojkvioBLJMA1l40ZyMIQ/FdzVbYwGQYx1k+K12PY109ba 558FEcGJGGwD+A5igMCTJPQBRmF0uOWtljtwWKyLanVIXHSKYBzJ/3R X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=IP4PywvG c=1 sm=1 tr=0 ts=69ada848 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=gAnH3GRIAAAA:8 a=lW4FyyzJGg7ItnWL1goA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-ORIG-GUID: WCOqDtrj5sPshPjvkZ55UqRjJ3ySxsCY X-Proofpoint-GUID: WCOqDtrj5sPshPjvkZ55UqRjJ3ySxsCY X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA4MDE1NCBTYWx0ZWRfXxEoiMI9sq69n iEC+9dnBmQZ0iBVuMmguYYN2iy8hI0j8gm7U95tBSg7/2xvU+ec+JTvCgdsubq9/eXB6GXnmZC1 4mRyruWzH01ieVYRiVK9sC8SwjuJtt70DHSlZ/efR3tLSWY5+AgywU+8jDK4QCTGvcZrjC8WLTN XUxVvJVJcxm+ZDFgeq5NZyq5wyeW1W0mmeZHi6Y/nbUU5kqJFFJD4dtXJFtbE9o3advNihgx1LF AcksX3KI6/rLC/HD3R0zryt6eUxeCMdbulxeRiBQ/jJYzF1Q0yTjjaaVqB8Jfxx0qLaISAUPSdc MRSFm2qb+H42WmZ0bQ8OHKObwZLFOy8KTBQ7p8P2WmTb/jsWMkA8BgSoGe8LxJtLAqmW8sXwiuA LFZAYxTKe/S/7pmkjt2uUdC24TaAbwCG4LKOLhNI8GwjsAlEgaIBXdpzYRov5MPrEt4C4cBmOJs zCJOXkCs/kZN9Es4p3Q== 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-08_04,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 malwarescore=0 adultscore=0 spamscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603080154 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. Signed-off-by: Jorge Marques --- drivers/i3c/master.c | 7 +++++-- drivers/i3c/master/adi-i3c-master.c | 3 +-- drivers/i3c/master/i3c-master-cdns.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 31822fd5ffde..ce1898345810 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1036,8 +1036,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) { @@ -1050,6 +1049,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 6616f751075a..fb9a48830446 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 b78aebf6b2ca..5cfec6761494 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 Thu Apr 9 13:33: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 40BEA348458 for ; Sun, 8 Mar 2026 16:48:30 +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=1772988511; cv=none; b=ihrJYEQokAhTn8zTP7nFf5ijTO7XGHVqM+5M+pc74DFspAsLSNlCtptGWNPdJrt9X16J46LdF4bnSDyjSqtKvH+g4PgcfkSZXg6eI8akXkhKTaS5PiFEyqHen+HbFUNUrStVYo3IBuEvBUAd2Ykq0lSrJzZhlUmxoevBwoxb07w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772988511; c=relaxed/simple; bh=OLd4gproiZWzSDd2UDgm7AnkTX/wotxorICxPJP1rn0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=fkSH2nBqiyy5oh2bboayXZlFp3W8ELG9RW24n1Ld6FwqZhVdKb3FQsRhUc1UQgnS5dFF2oGnXznYaHykyXeESwMgZD+oi54wJ3RrWDWxuOEWBpcAltQ9N9jcwa7+WnTXmWxwBh2Ye7ImEABxdaO2n8NsyT8fCg7eEO7YTP8bGUY= 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=nlAo9aMc; 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="nlAo9aMc" 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 62864D2U3743665; Sun, 8 Mar 2026 12:48:09 -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=QDziH Fn53Wmkd+vFmXeZjFQ0tKI3GH5idSyPJjkevOM=; b=nlAo9aMcsINsohMwZjyq6 om1IR1Ms/Mr/Xxl+8AZRi34MGouQhTjzUp97o/YJflDOgBVPsmNs5yYkirTguJVp Y+vnTIpjRBLEgratTDl8BMNWCVm/B5DenVkbKJWHkq9Z9xMSxGyRjJ1c/LE/4ayn go0X0toBiP/5ABOPm25BfP0qLkZFg+AY+g3LgMss9cDmBbvnv4fFLK+nQEzZ0kjs a14aBdWV08YiucMlQxxN7YurglOJlZNM77A7phTAEpq29dacX4mxtMgoqMQOntmW SqCxwM0VC+BG3LmEr1cDxZOb+Rhy5KV+Y6QyB7m4lKvF5kbMFNePlygN3M0urV+H Q== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4crer5urfw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 08 Mar 2026 12:48:09 -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 628Gm8rt014375 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 8 Mar 2026 12:48:08 -0400 Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) 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; Sun, 8 Mar 2026 12:48:08 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB5.ad.analog.com (10.64.17.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Sun, 8 Mar 2026 12:48:08 -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; Sun, 8 Mar 2026 12:48:08 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com ([10.66.6.192]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 628GlhfJ003692; Sun, 8 Mar 2026 12:48:00 -0400 From: Jorge Marques Date: Sun, 8 Mar 2026 17:47:39 +0100 Subject: [PATCH 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: <20260308-ad4062-positive-error-fix-v1-3-72d3c5290b4a@analog.com> References: <20260308-ad4062-positive-error-fix-v1-0-72d3c5290b4a@analog.com> In-Reply-To: <20260308-ad4062-positive-error-fix-v1-0-72d3c5290b4a@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=1772988463; l=1589; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=OLd4gproiZWzSDd2UDgm7AnkTX/wotxorICxPJP1rn0=; b=Xl24JGZ3B+2kxYlTIyb4qG36xaPywdiw0blu0js0Ftq7KXybxN0B9BmOPzbNMvK01Gp8BnxC2 hMNwZAvEU3aDJpgEoksdCApu2Bwshqiui/OEdOc7ecGCsAafCi+BI5e X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA4MDE1NCBTYWx0ZWRfX+uFmZfG0v2PJ 373rOU5W4k7kJSFVvQQDkzPv9NIYfUy7vKkaR2yD8IsNFH12JGFMu8nyMpeYzWdLr5zJPrwV0IF JaXGosKyqG/ptxLv61sCSVevs03rkmuQnPGMfX64+5WX9hwdLwZYSzYPJJigDg221qnlQW7Ycc8 MLNlHGhdjgJVZyUwyIQIe0GHjhd6IL64XdGSfaRjGgdb8+HRxcjpThGbBxfGo/yL2fPSI3M8N+e rXRhtNifAGBelwv2FdHaXntKIIWkY3eNBV3qWBjhvYaPPKNZlj7qsnieYuyyIyeSuf3L72MKZJJ eOYDmBfW5hCRl+E4nxAiw+n6xiA0bM3klPETnr4W8DFnNxr0dbezitMYEInpLscHuvph8P+KEVJ s1XiBQe1NQqwyjW8kHQn7rzObitorvLl1g4D4GXVG+Z3IHsF2yuyRhnN/fji30q3EOZPdDYadT8 tI1DEaRr0W97zBQw5ow== X-Proofpoint-ORIG-GUID: -Srvm5JMWMgKMrweAtzki0gm2Cr8BWz1 X-Proofpoint-GUID: -Srvm5JMWMgKMrweAtzki0gm2Cr8BWz1 X-Authority-Analysis: v=2.4 cv=YtkChoYX c=1 sm=1 tr=0 ts=69ada849 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=USoued4R0o-clvb-nzIA: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-08_04,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 spamscore=0 suspectscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603080154 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. Handle inside i3c_master_enec_disec_locked the exact corner case to not require propagating positive Mx error codes. Signed-off-by: Jorge Marques --- drivers/i3c/master.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index ce1898345810..3e465587c9c7 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1078,6 +1078,15 @@ static int i3c_master_enec_disec_locked(struct i3c_m= aster_controller *master, ret =3D i3c_master_send_ccc_cmd_locked(master, &cmd); i3c_ccc_cmd_dest_cleanup(&dest); =20 + /* + * If the addr is I3C_BROADCAST_ADDR and enable is false, the return + * error is cleared if the Mx error is I3C_ERROR_M2, to match the + * initialization state where there is no active device on the bus. + */ + if (ret && addr =3D=3D I3C_BROADCAST_ADDR && !enable && + cmd.err =3D=3D I3C_ERROR_M2) + ret =3D 0; + return ret; } =20 @@ -2112,7 +2121,7 @@ static int i3c_master_bus_init(struct i3c_master_cont= roller *master) 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) + if (ret) goto err_bus_cleanup; =20 /* --=20 2.51.1 From nobody Thu Apr 9 13:33: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 B7463346FB7 for ; Sun, 8 Mar 2026 16:48:29 +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=1772988511; cv=none; b=ZgUUop65LGI1T/1eNDvZeDJ7ileXHMXrC9jFMspf33wpqbnCHgNwvIhXM0DFfsZj6CE7T6Z40El8bOk+Sm87fu+O1C1CQtwbT5k9fk6BT58WuzPl4b45ca+G6LWMFXcRmPXYDwzrzIGjg1ByXyIp5uyz9O08IpVOE8pyxf5yNGs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772988511; c=relaxed/simple; bh=2L8F3wEbrWmn5r13QlXUSMAL+xNCy5F6Ta86TY5QAos=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=GTLfYgS4dChzc76cQQIlN9C7HuD0umnQeyx75mRo0JeQkcYktips/eDcaLYz1oORIVBPetO42ndcN5e6AqKEVL7h9XR5Pkabqel7M77QH8vmf98c3lVuZgGuRfNmfUGGZNTyB+Fp0abzQD5m4Cl5I+l3vYg0W0jv6/6OWwuc+xc= 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=Up2HFq/5; 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="Up2HFq/5" 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 628AqRTl1897330; Sun, 8 Mar 2026 12:48:09 -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=DY+XR 2dLMIlBMKlpuqtcDIGI/m3CPs5jGqtHsBq67vE=; b=Up2HFq/5zbDvYHsggoQPl hfE0wu+LO8xPkElw9vriOOI2VztL5rAq2qis0zJFo5b80VO8itvmYpXTEeMxiCvt L46KzXXmUOxRtOhkF6OOQnbDjl0FX3Vf4mmh/8IJagxj7qi67Om+DzOB5U8LSyOa udWRIqS5wIptRJia3/qpy6VYrSHYgNhOSYYI+jGOFCX8OL6en+8IJoP7tP0z1P0P 2NdVSzeW9ma2BvWQYNvi5ULYcIzcLK+RCqtKJTG1QgvCM9ey34oKj40v0/+vTqNp CWNF8HOPeiX4aDbgFmVX3Z3WZodaMJJo9ATVbWxxzAMYUn3BZMoMBULsNKS4qGz/ w== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4crht6ud1f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 08 Mar 2026 12:48:08 -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 628Gm76r014372 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 8 Mar 2026 12:48:07 -0400 Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) 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; Sun, 8 Mar 2026 12:48:07 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBCASHYB5.ad.analog.com (10.64.17.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Sun, 8 Mar 2026 12:48:07 -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; Sun, 8 Mar 2026 12:48:07 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com ([10.66.6.192]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 628GlhfK003692; Sun, 8 Mar 2026 12:48:01 -0400 From: Jorge Marques Date: Sun, 8 Mar 2026 17:47:40 +0100 Subject: [PATCH 4/5] i3c: master: Negative 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: <20260308-ad4062-positive-error-fix-v1-4-72d3c5290b4a@analog.com> References: <20260308-ad4062-positive-error-fix-v1-0-72d3c5290b4a@analog.com> In-Reply-To: <20260308-ad4062-positive-error-fix-v1-0-72d3c5290b4a@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=1772988463; l=3512; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=2L8F3wEbrWmn5r13QlXUSMAL+xNCy5F6Ta86TY5QAos=; b=M9Cim7N9Y6clbylfoXxetgc0TTyb5GaZ3aKvnk7zW8zOHMUxt4a0EbOFFkglqNUCr4L7dl8gS iO8psT+R4i3Agnvjq63Teh2YLULnFKbNGdWL67Z5OwSa9Xdvc32iHeI X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=f5RFxeyM c=1 sm=1 tr=0 ts=69ada848 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=VwQbUJbxAAAA:8 a=KKAkSRfTAAAA:8 a=gAnH3GRIAAAA:8 a=Eqnk1nJrLcZiEtcKfW8A:9 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: WEhgZdLpURoIQZBl9IgYH1GVXqvpPU1- X-Proofpoint-GUID: WEhgZdLpURoIQZBl9IgYH1GVXqvpPU1- X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA4MDE1NCBTYWx0ZWRfX7ETloNQ+2emd 0FT7i3ddU2FqpQRv7KPYPSYxWjYehlOnos5XSXTktWFimVZxgkIAmNGITALKx2tSjK0Z9Wk5AVs EOKEra/iJp23LtoFEKxqQNk89Gx2zSwSz/PNMpcqM8OwZGvyO1dZ0tJ/OqYJff25rkPNp/5oL+U cqY80t2s3qRNFBLZ/oY+6u/WnNc2grZxtmlmY4cBHfBMO2PQgaP33URRGYatjsAyZmCPyF4wwnE OivKK52PYjEidDJ1eHP/vO+ad/jqmrCVkEeCqapFz8s00qklQo0NYw5kZL2DL44DhsHBP0E4/GN YilApiu4NBCXGLrNcElLaSPv1ymx97kNFokesUSqhEbgKh2BXLSgClUcMQUL1U6KOXnapfVapDt GSBOXpncfJq/n+ORVTS+bb8yAa7KC3Vowi5oyvuRpxeLjmUJKhXLLfFbJZ8812h/HjaRfBr1B9b 12wQVZyYnxZxPHqKZ4w== 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-08_04,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 phishscore=0 adultscore=0 priorityscore=1501 spamscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603080154 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. Reported-by: Dan Carpenter Closes: https://lore.kernel.org/linux-iio/aYXvT5FW0hXQwhm_@stanley.mountain/ Signed-off-by: Jorge Marques --- drivers/i3c/master.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 3e465587c9c7..8459fffbdebb 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 * @@ -1101,8 +1099,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) @@ -1122,8 +1119,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) @@ -1148,8 +1144,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 Thu Apr 9 13:33: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 5731534B1B0 for ; Sun, 8 Mar 2026 16:48:32 +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=1772988513; cv=none; b=HGELgvNgrLkOxcaAhLsB9kKvPM7XDdc9J+i9g+gJw4f1dPuTY+eL2jeC7gL91VZJQow363MlOYKDLJgygMOkqpFcuA5ptJsJy7WebsgEtiXYFQVtD9nl2GkQeegJG2MLTIwvuubAOxxwl/B0R/MjZE8xcIWpU9k3V495IXX/pM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772988513; c=relaxed/simple; bh=JWBdR+1TIsvuhcqzYYchwYWj608bF8a4ahM3xFDDQ3M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=SVkVClOFuZfVeJL2r0caoezamclZc9XQ7eb0Is37sL+cnFrgOTi8jaKJzGFH6XRdsv8eBpMcoBmKtdtbQ6bsfmkqFAA9QHcXIo7mRyXPaNskkz7IMRodQ1QEAF+xREvOX2GDqnbTPbFn/evY/mKmuPFKk2G+dPZHOUFigjYPr64= 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=hAkHObp0; 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="hAkHObp0" 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 62888kDj1054216; Sun, 8 Mar 2026 12:48:10 -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=ui9np Tlq4v4aIzXXBurcjkefih3umh2C7ZZx9DHvDeg=; b=hAkHObp0wbEzG1CFnZ6p/ je2QFVyNS5XIL9afqBYVoWnlCGTpm1/6wSr8mWsm6YMFAemk+EUPHd4cD2Zo94XP NhQd1wq56ZCnTZNiSWU0WZ2bTK4EkUJWMXj9r7+mLG84/XknTDEfZVUPIIdZ1SdP yEaL45E23pkjoBLFu/ta7qP61yf+Hh/E+/3FkxcxcwyceQcyjxlv0AogWcVRn8CB LFSqr5f7rjtUwH2VZET8nH7TuH7a9BywzxtTCBLQ/rs8wMDlPkLSLW/aPX97IjK5 6kMYtGv09P7HAnxs9pktbupQeBn1tDWRPi8zzrelQtUZvuFQLf+SoZgZ+gttBjJT w== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4cs5bfrxch-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 08 Mar 2026 12:48:09 -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 628Gm8lQ014378 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 8 Mar 2026 12:48:08 -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; Sun, 8 Mar 2026 12:48:08 -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; Sun, 8 Mar 2026 12:48:08 -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; Sun, 8 Mar 2026 12:48:08 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com ([10.66.6.192]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 628GlhfL003692; Sun, 8 Mar 2026 12:48:03 -0400 From: Jorge Marques Date: Sun, 8 Mar 2026 17:47:41 +0100 Subject: [PATCH 5/5] i3c: master: adi: Return xfer->ret at send CCC 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: <20260308-ad4062-positive-error-fix-v1-5-72d3c5290b4a@analog.com> References: <20260308-ad4062-positive-error-fix-v1-0-72d3c5290b4a@analog.com> In-Reply-To: <20260308-ad4062-positive-error-fix-v1-0-72d3c5290b4a@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=1772988463; l=853; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=JWBdR+1TIsvuhcqzYYchwYWj608bF8a4ahM3xFDDQ3M=; b=B80T4uSWak4aSl3HyDlmGpUnjOVdNfGoRjnSUaTJQ+d0kcX0ra2UvQp8nLbMpCMsleln2W3Rp b7j2MNSI0n8BUf0u5b8Jzsi7NrYtYu4HTUUoY9E2EJaLdwqo2IQVTri X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=IP4PywvG c=1 sm=1 tr=0 ts=69ada84a 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=gAnH3GRIAAAA:8 a=7Wge7DrbkOJa_FxU4nsA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-ORIG-GUID: BggJjlY5LP8wjvLYhud-rjgNK6lEt7qv X-Proofpoint-GUID: BggJjlY5LP8wjvLYhud-rjgNK6lEt7qv X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA4MDE1NCBTYWx0ZWRfX0wIbCoKn+GOP PVf0hOnbeSP2q9Y9fMHugW1FZ7b479SIZ56ynxJQwGLCaEaFp7/5vC3w2JVG9hqi+OAZKMmu9HJ xoXXDdIH0bwh22lN0q/jNnDaQgaEBauQ4dWypYQv1TJHQiHGYQKeBMGpMHxtPZkipAeBBqqyKqE kSBy8aIYRhM6oxItLqZB1yhRxSoS4cLoxZNMqT/uly0/WZiakEjK04WmEMZ89+sYnEzkL1NCpSa fSNlXsCqazbpEQQWOXaUh60lJiKPiyeWSc+c+GB4VlD11azTji/92JemaWtqJDnq12oIHI1/qLx A3CxzHVyIAVD9Ih9FpHcYZJfXg/cSHSMyyk67qe/QNn6VBPRyvdTHPWuWdeP19uZTtu+io9iBEW vlyojkCTPLU3ERvhMAZtVP6WiUqfTErrRZCR2Iua9Ia79a6mygLSMjXUscTIm5IBIy+ArkCqCZJ Q4B3jXPdZ9u1uziiwhg== 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-08_04,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 malwarescore=0 adultscore=0 spamscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603080154 Return the xfer-> ret error code at adi_i3c_master_send_ccc_cmd to propagate the adi_i3c_master_end_xfer_locked value. In particular, if any of the Mx values are present in the sent commands, returns -EIO. 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 fb9a48830446..047081c9f064 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