From patchwork Thu Sep 24 15:29:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemyslaw Marczak X-Patchwork-Id: 522395 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5A4471401F6 for ; Fri, 25 Sep 2015 01:31:08 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C6F704B83D; Thu, 24 Sep 2015 17:30:59 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VxbX_r8zSfrp; Thu, 24 Sep 2015 17:30:59 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B4F244B881; Thu, 24 Sep 2015 17:30:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 626724B83D for ; Thu, 24 Sep 2015 17:30:37 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XiWk0X1vED66 for ; Thu, 24 Sep 2015 17:30:37 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by theia.denx.de (Postfix) with ESMTPS id 3354D4B862 for ; Thu, 24 Sep 2015 17:30:33 +0200 (CEST) Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NV6001V9TQUHK20@mailout2.w1.samsung.com> for u-boot@lists.denx.de; Thu, 24 Sep 2015 16:30:30 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-34-560417164a6c Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 67.15.05269.61714065; Thu, 24 Sep 2015 16:30:30 +0100 (BST) Received: from AMDC1186.digital.local ([106.116.147.185]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NV600AWETQQDQ70@eusync3.samsung.com>; Thu, 24 Sep 2015 16:30:30 +0100 (BST) From: Przemyslaw Marczak To: u-boot@lists.denx.de Date: Thu, 24 Sep 2015 17:29:48 +0200 Message-id: <1443108590-16871-2-git-send-email-p.marczak@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1443108590-16871-1-git-send-email-p.marczak@samsung.com> References: <1443108590-16871-1-git-send-email-p.marczak@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKLMWRmVeSWpSXmKPExsVy+t/xq7pi4ixhBi+nKVjc+NXGavHm4WZG i44jLYwWOy7fYLH4tmUbo8WN6S2sFm2rP7BavN3bye7A4TG74SKLx9k7Oxg9/h1j9+htfsfm 0bdlFWMAaxSXTUpqTmZZapG+XQJXxpVzVQWLuCtW/eJtYGzm7GLk5JAQMJFY0baEGcIWk7hw bz1bFyMXh5DAUkaJmytPs0I4zUwSzz/fYQWpYhMwkNhz6QxYh4iAhMSv/quMIDazQB+TROtf gy5GDg5hgXiJbX/VQMIsAqoSh96+YgGxeQVcJT6c3sECsUxO4uSxyWAjOQXcJH7e/c4I0ioE VNPc4DSBkXcBI8MqRtHU0uSC4qT0XCO94sTc4tK8dL3k/NxNjJDA+rqDcekxq0OMAhyMSjy8 M3WYw4RYE8uKK3MPMUpwMCuJ8B4QYQkT4k1JrKxKLcqPLyrNSS0+xCjNwaIkzjtz1/sQIYH0 xJLU7NTUgtQimCwTB6dUA2O2+LPwtrnc286Xf+LoWyysEhWmv+Esb+unVw3dx+yzt1k/dlXY 1Hx8/uuNQvFcoi0T90pbTbeMU5ru9rk3RuTpzdMPzZumJ7rfqnBXuGdXGcUrv2/j7SWMhjL8 Xyw1/oiVxq5Z6byrad+paU49L0Xj47LyL/z9L8ZV0xSQe4Kj2Cpzx90ofiWW4oxEQy3mouJE AFSyoq4oAgAA Cc: Stephen Warren , Jaehoon Chung , tjakobi@math.uni-bielefeld.de, Przemyslaw Marczak Subject: [U-Boot] [PATCH 1/3] fix: fdtdec: allow parse 'reg' property with zero value in '#size-cells' X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" After rework of lib/fdtdec.c by commit: commit 02464e386bb5f0a022c121f95ae75cf583759d95 Author: Stephen Warren Date: Thu Aug 6 15:31:02 2015 -0600 the function fdtdec_get_addr() doesn't work as previous, because the implementation assumes that properties '#address-cells' and '#size-cells' are equal to 1, which can be not true sometimes. The new API introduced fdtdec_get_addr_size_auto_parent() for the 'reg' property parsing, but the implementation assumes, that #size-cells can't be less than 1. This causes that the following children's 'reg' property can't be reached: parent@0x0 { #address-cells = <1>; #size-cells = <0>; children@0x100 { reg = < 0x100 >; }; }; Change the condition value from '1' to '0', which allows parsing property with at least zero #size-cells, fixes the issue. Now, fdtdec_get_addr_size_auto_parent() works properly. Signed-off-by: Przemyslaw Marczak Acked-by: Stephen Warren --- lib/fdtdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 9f0b65d..9cf57b9 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -149,7 +149,7 @@ fdt_addr_t fdtdec_get_addr_size_auto_parent(const void *blob, int parent, } ns = fdt_size_cells(blob, parent); - if (ns < 1) { + if (ns < 0) { debug("(bad #size-cells)\n"); return FDT_ADDR_T_NONE; }