From patchwork Thu Dec 30 16:31:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 529328 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 F2FADC433F5 for ; Thu, 30 Dec 2021 16:32:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240284AbhL3Qc4 (ORCPT ); Thu, 30 Dec 2021 11:32:56 -0500 Received: from guitar.tcltek.co.il ([84.110.109.230]:59582 "EHLO mx.tkos.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241210AbhL3Qcz (ORCPT ); Thu, 30 Dec 2021 11:32:55 -0500 Received: from tarshish.tkos.co.il (unknown [10.0.8.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx.tkos.co.il (Postfix) with ESMTPS id 968A944066E; Thu, 30 Dec 2021 18:32:39 +0200 (IST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tkos.co.il; s=default; t=1640881959; bh=6qFmNs+cXJBH4B82lkkaVUCvmgNQXGaOr7lviQAYqMM=; h=From:To:Cc:Subject:Date:From; b=K+PYZrzrxMkGwe7X0sfV1xVPWlzlAx6HxPvoKyAz/cW0Srwt1kwulbsWm7K32uReS v97Hnypu/9F6/j8xWgoBnDY58Cf5crbHjk/WJCKOqDUVfXi0JOyTEmniVXYI+qWxX5 fAndKXX+9+aSxqg3qkS97awS38Lv/DiGmM+PS0eToIULMZhNbHr25K/dRIH3yO7doL Eau7PlD23Gxje+EEUT71zOg1tMHXAXJ5Zz+Lcuqji916Q46Y/fwG6/A/k/B+Pcd7XQ /v5QTnGEbmDlFDagjq65JOJcJCOU8E7NHyWy+HH7EP+c06OqleGsFcKNNtIe5dhKJr 0Cikk+YCCouyg== From: Baruch Siach To: Rob Herring , Frank Rowand Cc: devicetree@vger.kernel.org, Baruch Siach , Florian Fainelli Subject: [PATCH v2 1/2] of: base: Fix phandle argument length mismatch error message Date: Thu, 30 Dec 2021 18:31:52 +0200 Message-Id: <96519ac55be90a63fa44afe01480c30d08535465.1640881913.git.baruch@tkos.co.il> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The cell_count field of of_phandle_iterator is the number of cells we expect in the phandle arguments list when cells_name is missing. The error message should show the number of cells we actually see. Fixes: af3be70a321 ("of: Improve of_phandle_iterator_next() error message") Cc: Florian Fainelli Signed-off-by: Baruch Siach --- v2: Use correct length modifier for ptrdiff_t --- drivers/of/base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 61de453b885c..81b956ab2348 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1349,9 +1349,9 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it) * property data length */ if (it->cur + count > it->list_end) { - pr_err("%pOF: %s = %d found %d\n", + pr_err("%pOF: %s = %d found %td\n", it->parent, it->cells_name, - count, it->cell_count); + count, it->list_end - it->cur); goto err; } } From patchwork Thu Dec 30 16:31:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 529009 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 D4CE5C433EF for ; Thu, 30 Dec 2021 16:32:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241216AbhL3Qc4 (ORCPT ); Thu, 30 Dec 2021 11:32:56 -0500 Received: from guitar.tcltek.co.il ([84.110.109.230]:59583 "EHLO mx.tkos.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240284AbhL3Qcz (ORCPT ); Thu, 30 Dec 2021 11:32:55 -0500 Received: from tarshish.tkos.co.il (unknown [10.0.8.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx.tkos.co.il (Postfix) with ESMTPS id D30AF440A74; Thu, 30 Dec 2021 18:32:39 +0200 (IST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tkos.co.il; s=default; t=1640881960; bh=zywokNN1UEwcjxXdg0IGIXWNGUhkAG1XofjdXiIOozU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gxqiiu9nCpZpV5sSm404nzqh2icUtyPrYeaDBiVIY63htZsWovEGHRirf8yTuV13y pgHcLKvPuekY9PAfcqu8T5fDPI5hJUjwBDT2ymRjeKrbGHOZ7I5rPHwxRYXalyl/6v xYdyjLdqqE4Axf4zKH0nQzbanxntcnN5iuZHdZIswMkmcOcnqHzfV7zwmI37K3jAnA PhH+Bql/FNC48+XEdB/ljaEkm0obsgbrlXoP/kmkrrcgW8uwEeQINiIhuGUyaRgTXe kIMfd4bhMkzwKLs8NQ2OlB1CRCj0xL5glANIshjoCrdfyKwSD8Gw0IRuuVq6p7KDGB OVMVISu7Kyqdg== From: Baruch Siach To: Rob Herring , Frank Rowand Cc: devicetree@vger.kernel.org, Baruch Siach Subject: [PATCH v2 2/2] of: base: Improve argument length mismatch error Date: Thu, 30 Dec 2021 18:31:53 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: <96519ac55be90a63fa44afe01480c30d08535465.1640881913.git.baruch@tkos.co.il> References: <96519ac55be90a63fa44afe01480c30d08535465.1640881913.git.baruch@tkos.co.il> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The cells_name field of of_phandle_iterator might be NULL. Use the phandle name instead. With this change instead of: OF: /soc/pinctrl@1000000: (null) = 3 found 2 We get: OF: /soc/pinctrl@1000000: phandle pinctrl@1000000 needs 3, found 2 Which is a more helpful messages making DT debugging easier. In this particular example the phandle name looks like duplicate of the same node name. But note that the first node is the parent node (it->parent), while the second is the phandle target (it->node). They happen to be the same in the case that triggered this improvement. See commit 72cb4c48a46a ("arm64: dts: qcom: ipq6018: Fix gpio-ranges property"). Signed-off-by: Baruch Siach --- Note that commit 72cb4c48a46a mentioned above is currently in the arm64-for-5.17 branch of the qcom git tree. v2: Extend the commit log to explain the apparent node name duplication --- drivers/of/base.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 81b956ab2348..09905b5e7b43 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1349,9 +1349,14 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it) * property data length */ if (it->cur + count > it->list_end) { - pr_err("%pOF: %s = %d found %td\n", - it->parent, it->cells_name, - count, it->list_end - it->cur); + if (it->cells_name) + pr_err("%pOF: %s = %d found %td\n", + it->parent, it->cells_name, + count, it->list_end - it->cur); + else + pr_err("%pOF: phandle %s needs %d, found %td\n", + it->parent, of_node_full_name(it->node), + count, it->list_end - it->cur); goto err; } }