{"id":816177,"url":"http://patchwork.ozlabs.org/api/patches/816177/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170920115041.2307-1-klaus.goger@theobroma-systems.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170920115041.2307-1-klaus.goger@theobroma-systems.com>","list_archive_url":null,"date":"2017-09-20T11:50:41","name":"[U-Boot] dm: ofnode: query correct property in livetree ofnode_get_addr_size","commit_ref":"68a345294ac74505f17d65b003a7de836b3d9cba","pull_url":null,"state":"accepted","archived":false,"hash":"6e3882200ae3e5cede1a67068daf3959520d5fc0","submitter":{"id":64320,"url":"http://patchwork.ozlabs.org/api/people/64320/?format=json","name":"Klaus Goger","email":"klaus.goger@theobroma-systems.com"},"delegate":{"id":3184,"url":"http://patchwork.ozlabs.org/api/users/3184/?format=json","username":"sjg","first_name":"Simon","last_name":"Glass","email":"sjg@chromium.org"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170920115041.2307-1-klaus.goger@theobroma-systems.com/mbox/","series":[{"id":4099,"url":"http://patchwork.ozlabs.org/api/series/4099/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=4099","date":"2017-09-20T11:50:41","name":"[U-Boot] dm: ofnode: query correct property in livetree ofnode_get_addr_size","version":1,"mbox":"http://patchwork.ozlabs.org/series/4099/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816177/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816177/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxzJl33Q3z9t2V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 22:17:27 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 2CF55C21F21; Wed, 20 Sep 2017 12:17:19 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id CF6B0C21D5F;\n\tWed, 20 Sep 2017 12:17:16 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 0FDB2C21D55; Wed, 20 Sep 2017 11:51:07 +0000 (UTC)","from mail.theobroma-systems.com (vegas.theobroma-systems.com\n\t[144.76.126.164])\n\tby lists.denx.de (Postfix) with ESMTPS id C5570C21CB3\n\tfor <u-boot@lists.denx.de>; Wed, 20 Sep 2017 11:51:06 +0000 (UTC)","from [86.59.122.178] (port=58924 helo=blau.lan)\n\tby mail.theobroma-systems.com with esmtps\n\t(TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80)\n\t(envelope-from <klaus.goger@theobroma-systems.com>)\n\tid 1dudWz-0006v3-Ms; Wed, 20 Sep 2017 13:51:05 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=none autolearn=unavailable\n\tautolearn_force=no version=3.4.0","From":"Klaus Goger <klaus.goger@theobroma-systems.com>","To":"U-Boot Mailing List <u-boot@lists.denx.de>","Date":"Wed, 20 Sep 2017 13:50:41 +0200","Message-Id":"<20170920115041.2307-1-klaus.goger@theobroma-systems.com>","X-Mailer":"git-send-email 2.11.0","X-Mailman-Approved-At":"Wed, 20 Sep 2017 12:17:15 +0000","Cc":"Klaus Goger <klaus.goger@theobroma-systems.com>","Subject":"[U-Boot] [PATCH] dm: ofnode: query correct property in livetree\n\tofnode_get_addr_size","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"The livetree codepath of ofnode_get_addr_size always used the \"reg\"\nproperty for of_get_property. Use the property parameter of the function\ncall instead and check the return value if the property exists.\nOtherwise return FDT_ADDR_T_NONE.\n\nThis was discoverd while using SPI NOR with livetree.\nspi_flash_decode_fdt checks for memory-map and will not fail with\nlivetree even if the property does not exist.\n\nSigned-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>\nReviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>\n\n---\n\n drivers/core/ofnode.c | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)","diff":"diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c\nindex c6ca13fabf..0030ab962e 100644\n--- a/drivers/core/ofnode.c\n+++ b/drivers/core/ofnode.c\n@@ -468,8 +468,10 @@ fdt_addr_t ofnode_get_addr_size(ofnode node, const char *property,\n \t\tint na, ns;\n \t\tint psize;\n \t\tconst struct device_node *np = ofnode_to_np(node);\n-\t\tconst __be32 *prop = of_get_property(np, \"reg\", &psize);\n+\t\tconst __be32 *prop = of_get_property(np, property, &psize);\n \n+\t\tif (!prop)\n+\t\t\treturn FDT_ADDR_T_NONE;\n \t\tna = of_n_addr_cells(np);\n \t\tns = of_n_addr_cells(np);\n \t\t*sizep = of_read_number(prop + na, ns);\n","prefixes":["U-Boot"]}