From patchwork Fri Nov 17 14:45:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 119157 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp606558qgn; Fri, 17 Nov 2017 06:45:24 -0800 (PST) X-Google-Smtp-Source: AGs4zMa2fiT9D3daZZpn8HFFxSqYM3tuv6VUvhx4I2WI3s1zGCKGtGzqn9vFn/mpYoql8ELv6s2A X-Received: by 10.98.214.145 with SMTP id a17mr2270133pfl.167.1510929924290; Fri, 17 Nov 2017 06:45:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510929924; cv=none; d=google.com; s=arc-20160816; b=gXnsf5/4fIggJxXOxl/IUG7w40gcpasoxXEXtsPS+JtGl+d7GGluIDUmM100n8c5PY bLzokEKLQNEnPcwsO5/9avfnKFI3BLLhagLXjOWlo7ApCeo9t/bV+4qGNSGMk6ZLZbUd 4LEnXLB8xOFJV2mq31zwOz7Xs967Bk+drtkaDEe+vnrh5mj2MVvv7W5mxi0SUR13GLZ3 Sli1RWTAfRwQ2mrdkKcvjw7nv3flrE6WOaHJPEAv9HPrzsXr697roTF/Zq1SxZNKjEQ8 tYe7IyO0fFhwF27wr2U2LqeyvJ7Vz3HzKHbinjEHwa5i5vPHQ7XsQa97kmlNH4TnNyph PTpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=8z4P2dUAnjEJZtRyTRaW2iuw9KLsGihoRpCQNsCp37s=; b=MNFqyXEqWFwBkrOsqw8MKNXsjt3eGUAOi6SSZSOLgrNst3bduxAnOo6bCkZCvmjet1 0FB/oB+yfAZxqgVg08+rlOhMbvgQKppJ4G0jNqadSIuqR21zR46HUvKMEZ0/XZxRW3q+ jy3qa2xVuRCUoppXDZM7b1amlWfzhV0Fyp7vYagXmspDiM79+xvbHeiB9keYVeTzTXe8 F/HjkCQq5k+nzoPGwq3rvHPn1c+KPypua2j5qYeWajy3KWJiE4i6xYDmsJ3eIv5D0eQc ny08pc5gZyGTGWUkNZnV/awWA3OPn+J0qNlXGjEhDxv0Dn4LBKjjNv0Ep5MinQO46pRT MUlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8si3129534pfa.310.2017.11.17.06.45.24; Fri, 17 Nov 2017 06:45:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964972AbdKQOpW (ORCPT + 6 others); Fri, 17 Nov 2017 09:45:22 -0500 Received: from mail-ot0-f196.google.com ([74.125.82.196]:35822 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964975AbdKQOpV (ORCPT ); Fri, 17 Nov 2017 09:45:21 -0500 Received: by mail-ot0-f196.google.com with SMTP id b17so2190867oth.2; Fri, 17 Nov 2017 06:45:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2RHpiPteFNz/c+xV35m85oOauUuLeJgpdT32vjxr03I=; b=coK1q8Qbfi4Ew3Uz8ZsGnHHyRtd1WrsKznWzO5saHFXW4e7Ex3BU3NBTjQycIT0/gF At5W+J0LxlbeHmejUhQlA83rKEfbfRv1OhAo+cRsKOeL4Fivv8vvhaobw/A3n+fNrkeL UVDgq3kGvgHp8wfzRXpzy+42cUH3PL/Pc9wlcdSL3nqcaBRqshweEIeSQ7uruiTgeUML RYzNpcSr22p+YO3hlHpdURmWKYbWJsrxiIe9ymWq8z+m3AsC0N2ARqqoU3EphcKvWTJO wOYfwzeEat/MVlhEmbRXoj1nsL8KMBdQ6ZkFWV/Z91SczgDfWAebitXBXo+LG6Bh7HlF fcSw== X-Gm-Message-State: AJaThX5EgpUfAy1hDX63RYI762hiuuZ98wPidewfFa0rlEYXv7+957B+ 3IFkc2bxGC2doZDtobhwkdCwzpY= X-Received: by 10.157.39.134 with SMTP id c6mr1416270otb.259.1510929920120; Fri, 17 Nov 2017 06:45:20 -0800 (PST) Received: from xps15.herring.priv (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id i6sm1529906oiy.37.2017.11.17.06.45.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 06:45:19 -0800 (PST) From: Rob Herring To: devicetree-compiler@vger.kernel.org Cc: devicetree@vger.kernel.org Subject: [PATCH 4/5] checks: check for #{size, address}-cells without child nodes Date: Fri, 17 Nov 2017 08:45:14 -0600 Message-Id: <20171117144515.10870-5-robh@kernel.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171117144515.10870-1-robh@kernel.org> References: <20171117144515.10870-1-robh@kernel.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org nodes with a 'reg' property nor a ranges property. An exception may be an overlay that adds nodes, but this case would need Signed-off-by: Rob Herring --- checks.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/checks.c b/checks.c index 346b0256f9cb..a785b81bea07 100644 --- a/checks.c +++ b/checks.c @@ -982,6 +982,31 @@ static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti, WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL, &addr_size_cells); +static void check_avoid_unecessary_addr_size(struct check *c, struct dt_info *dti, + struct node *node) +{ + struct property *prop; + struct node *child; + bool has_reg = false; + + if (!node->parent || node->addr_cells < 0 || node->size_cells < 0) + return; + + if (get_property(node, "ranges") || !node->children) + return; + + for_each_child(node, child) { + prop = get_property(child, "reg"); + if (prop) + has_reg = true; + } + + if (!has_reg) + FAIL(c, dti, "unnecessary #address-cells/#size-cells without \"ranges\" or child \"reg\" property in %s", + node->fullpath); +} +WARNING(avoid_unecessary_addr_size, check_avoid_unecessary_addr_size, NULL, &avoid_default_addr_size); + static void check_obsolete_chosen_interrupt_controller(struct check *c, struct dt_info *dti, struct node *node) @@ -1306,6 +1331,7 @@ static struct check *check_table[] = { &simple_bus_reg, &avoid_default_addr_size, + &avoid_unecessary_addr_size, &obsolete_chosen_interrupt_controller, &clocks_property,