From patchwork Thu Nov 20 15:40:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 41241 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F341A23C27 for ; Thu, 20 Nov 2014 15:41:02 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gd6sf1956819lab.4 for ; Thu, 20 Nov 2014 07:41:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=TvqK+gOSiLNfvoKvn93smBa0zaew9CyGAttOHxb1Uas=; b=JAdO+WMpZcgektaKP3/YY8Q9mI2OnbrcBnHdbkgXX5wUB6u+j1mcOcqY0gztPAnnQi lr3Fp1Q4NUW5L12wHkh4EFjD82jZJlPzGf0GiBsI5nZlOFzsp5ruPCmWdqMT6FGF48A3 5nc3rEdb0d/9eMoGFfz3Ib2VTsPo2AihLFaKKIVrHBM161R/LqmqbYdQHRyMr0I4qOdS BXMwiMuD8rrg/96F/9MilGceWMHq9L0Irhz2/VY4EQjuSf01l7fYxePq2MXUJ8N8sW7i 8sDHkeh4syp6FIzm/5ZqRW0P4XDYzlSANvY1nTjRMCmQRaZPxJ0mfHuKr/8Ib0rZMtUG yNLQ== X-Gm-Message-State: ALoCoQkFwmGFLmp4TaGuPDOtZj0zyLY9dIg0AddM0lLiJm8gmtqHh00yVAPe6ICsGS7omkXiyexK X-Received: by 10.112.48.6 with SMTP id h6mr144417lbn.19.1416498061891; Thu, 20 Nov 2014 07:41:01 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.133 with SMTP id r5ls70554laa.65.gmail; Thu, 20 Nov 2014 07:41:01 -0800 (PST) X-Received: by 10.112.132.2 with SMTP id oq2mr7773223lbb.11.1416498061660; Thu, 20 Nov 2014 07:41:01 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id rf8si2319365lbb.139.2014.11.20.07.41.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Nov 2014 07:41:01 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id p9so1476291lbv.28 for ; Thu, 20 Nov 2014 07:41:01 -0800 (PST) X-Received: by 10.112.45.102 with SMTP id l6mr11792962lbm.46.1416498061543; Thu, 20 Nov 2014 07:41:01 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp283150lbc; Thu, 20 Nov 2014 07:41:00 -0800 (PST) X-Received: by 10.66.180.228 with SMTP id dr4mr42611354pac.34.1416498060042; Thu, 20 Nov 2014 07:41:00 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si3843088pdk.88.2014.11.20.07.40.59 for ; Thu, 20 Nov 2014 07:41:00 -0800 (PST) Received-SPF: none (google.com: devicetree-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755887AbaKTPk6 (ORCPT + 4 others); Thu, 20 Nov 2014 10:40:58 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:42369 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751406AbaKTPk5 (ORCPT ); Thu, 20 Nov 2014 10:40:57 -0500 Received: by mail-wi0-f169.google.com with SMTP id r20so12352355wiv.4 for ; Thu, 20 Nov 2014 07:40:56 -0800 (PST) X-Received: by 10.194.249.70 with SMTP id ys6mr34844743wjc.61.1416498056135; Thu, 20 Nov 2014 07:40:56 -0800 (PST) Received: from trevor.secretlab.ca (host86-166-84-117.range86-166.btcentralplus.com. [86.166.84.117]) by mx.google.com with ESMTPSA id dx8sm4593953wib.2.2014.11.20.07.40.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Nov 2014 07:40:55 -0800 (PST) Received: by trevor.secretlab.ca (Postfix, from userid 1000) id 8BC00C412DD; Thu, 20 Nov 2014 15:40:50 +0000 (GMT) From: Grant Likely To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Grant Likely , Rob Herring , Gaurav Minocha , Subject: [PATCH] of/selftest: Fix testing when /aliases is missing Date: Thu, 20 Nov 2014 15:40:30 +0000 Message-Id: <1416498030-5878-1-git-send-email-grant.likely@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: grant.likely@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The /aliases node isn't always present in the device tree, but the unittest code assumes that /aliases is there. Add a check when inserting the testcase data to see if of_aliases needs to be updated, and undo the settings when the nodes are removed. Signed-off-by: Grant Likely Cc: Rob Herring Cc: Gaurav Minocha Cc: --- drivers/of/selftest.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index e6c14dc400e9..e2d79afa9dc6 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c @@ -899,7 +899,11 @@ static void selftest_data_remove(void) while (last_node_index-- > 0) { if (nodes[last_node_index]) { np = of_find_node_by_path(nodes[last_node_index]->full_name); - if (strcmp(np->full_name, "/aliases") != 0) { + if (np == nodes[last_node_index]) { + if (of_aliases == np) { + of_node_put(of_aliases); + of_aliases = NULL; + } detach_node_and_children(np); } else { for_each_property_of_node(np, prop) { @@ -920,6 +924,8 @@ static int __init of_selftest(void) res = selftest_data_add(); if (res) return res; + if (!of_aliases) + of_aliases = of_find_node_by_path("/aliases"); np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); if (!np) {