From nobody Sun Feb 8 16:31:03 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BC06EB64D8 for ; Wed, 21 Jun 2023 16:20:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232128AbjFUQU0 (ORCPT ); Wed, 21 Jun 2023 12:20:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbjFUQUP (ORCPT ); Wed, 21 Jun 2023 12:20:15 -0400 Received: from imap4.hz.codethink.co.uk (imap4.hz.codethink.co.uk [188.40.203.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DF3F10CE for ; Wed, 21 Jun 2023 09:20:10 -0700 (PDT) Received: from [167.98.27.226] (helo=rainbowdash) by imap4.hz.codethink.co.uk with esmtpsa (Exim 4.94.2 #2 (Debian)) id 1qC0Yx-0016ia-Dk; Wed, 21 Jun 2023 17:20:07 +0100 Received: from ben by rainbowdash with local (Exim 4.96) (envelope-from ) id 1qC0Yx-001z4h-0Y; Wed, 21 Jun 2023 17:20:07 +0100 From: Ben Dooks To: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, alexandre.belloni@bootlin.com Cc: Ben Dooks Subject: [RFC 4/5] i3c: show error messages in of_i3c_master_add_i3c_boardinfo Date: Wed, 21 Jun 2023 17:20:04 +0100 Message-Id: <20230621162005.473049-5-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230621162005.473049-1-ben.dooks@codethink.co.uk> References: <20230621162005.473049-1-ben.dooks@codethink.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If of_i3c_master_add_i3c_boardinfo() fails, then there's no much to say what the issue was (most of the error returns are -EINVAL), so add some printing of the errors using dev_err() showing the node that failed and what the issue was. This should help with finding which device-tree node was causing the issue and also mirrors the i2c case where it shows the node and the error. Signed-off-by: Ben Dooks --- drivers/i3c/master.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index bc42669f5c6d..2a9ebb1d9d57 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -2050,32 +2050,42 @@ of_i3c_master_add_i3c_boardinfo(struct i3c_master_c= ontroller *master, return -ENOMEM; =20 if (reg[0]) { - if (reg[0] > I3C_MAX_ADDR) + if (reg[0] > I3C_MAX_ADDR) { + dev_err(dev, "%pOF: address too big\n", node); return -EINVAL; + } =20 addrstatus =3D i3c_bus_get_addr_slot_status(&master->bus, reg[0]); - if (addrstatus !=3D I3C_ADDR_SLOT_FREE) + if (addrstatus !=3D I3C_ADDR_SLOT_FREE) { + dev_err(dev, "%pOF: slot in use\n", node); return -EINVAL; + } } =20 boardinfo->static_addr =3D reg[0]; =20 if (!of_property_read_u32(node, "assigned-address", &init_dyn_addr)) { - if (init_dyn_addr > I3C_MAX_ADDR) + if (init_dyn_addr > I3C_MAX_ADDR) { + dev_err(dev, "%pOF: cannot assign address\n", node); return -EINVAL; + } =20 addrstatus =3D i3c_bus_get_addr_slot_status(&master->bus, init_dyn_addr); - if (addrstatus !=3D I3C_ADDR_SLOT_FREE) + if (addrstatus !=3D I3C_ADDR_SLOT_FREE) { + dev_err(dev, "%pOF: slot in use\n", node); return -EINVAL; + } } =20 boardinfo->pid =3D ((u64)reg[1] << 32) | reg[2]; =20 if ((boardinfo->pid & GENMASK_ULL(63, 48)) || - I3C_PID_RND_LOWER_32BITS(boardinfo->pid)) + I3C_PID_RND_LOWER_32BITS(boardinfo->pid)) { + dev_err(dev, "%pOF: bad PID\n", node); return -EINVAL; + } =20 boardinfo->init_dyn_addr =3D init_dyn_addr; boardinfo->of_node =3D of_node_get(node); --=20 2.40.1