From patchwork Thu Oct 2 12:12:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 38292 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3291F20BF9 for ; Thu, 2 Oct 2014 12:12:49 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id d17sf1092468eek.6 for ; Thu, 02 Oct 2014 05:12:48 -0700 (PDT) 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=4UiM4stLDITrfmjmCaCi+MdKipFIxtKmD9HUQRLpxgI=; b=XxgLOsOW8C4Tnk1uc1A5A4I+XxsxJoMIYeenU268r2rQeWbTWtQ/5ZaoeBFm1Egjei wCR7glVc+r3YPhB6O+1cJ0aqX5Fjfza+onQJ4SWslIkyfeX3ZAbisGHPo8Q4DCuhLu+k +x4RA74Ua+m4My1Zakz2BiAz3+LVuwJI2NbaBfRYMFLB1penlhQVfaIIlXodfe840ng1 +jvQcv0O/b+u5O0y8cn+9PfskfBU/CxB6nw93gzCOYaitJUBbQ3GlWiv5hRJG1by8vOx ojHFlXXDvvo5UysumMXcw4bXOf2Pqz/v7+kvaYC9c9LltQrkwGtSlzv92Ae755ikooMB JAjg== X-Gm-Message-State: ALoCoQmiTWsjo8vz/HXLQSMtmSWYbOL2XTztfkBJHv5Z5DPgyR2CKbusfcg8knl8exBJMw79fUrO X-Received: by 10.181.28.169 with SMTP id jp9mr576861wid.6.1412251968320; Thu, 02 Oct 2014 05:12:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.227 with SMTP id z3ls264113lad.44.gmail; Thu, 02 Oct 2014 05:12:47 -0700 (PDT) X-Received: by 10.152.44.136 with SMTP id e8mr63212704lam.36.1412251967730; Thu, 02 Oct 2014 05:12:47 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) by mx.google.com with ESMTPS id f4si6333012lag.46.2014.10.02.05.12.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Oct 2014 05:12:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id w7so2111791lbi.37 for ; Thu, 02 Oct 2014 05:12:47 -0700 (PDT) X-Received: by 10.152.5.168 with SMTP id t8mr62049333lat.67.1412251967249; Thu, 02 Oct 2014 05:12:47 -0700 (PDT) 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.130.169 with SMTP id of9csp40458lbb; Thu, 2 Oct 2014 05:12:46 -0700 (PDT) X-Received: by 10.68.164.35 with SMTP id yn3mr87072327pbb.104.1412251965726; Thu, 02 Oct 2014 05:12:45 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rc5si3780417pbc.60.2014.10.02.05.12.45 for ; Thu, 02 Oct 2014 05:12:45 -0700 (PDT) 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 S1752388AbaJBMMo (ORCPT + 5 others); Thu, 2 Oct 2014 08:12:44 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:47804 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752283AbaJBMMo (ORCPT ); Thu, 2 Oct 2014 08:12:44 -0400 Received: by mail-wi0-f171.google.com with SMTP id em10so1144942wid.4 for ; Thu, 02 Oct 2014 05:12:43 -0700 (PDT) X-Received: by 10.180.97.98 with SMTP id dz2mr3703091wib.26.1412251963027; Thu, 02 Oct 2014 05:12:43 -0700 (PDT) Received: from trevor.secretlab.ca (host86-166-87-213.range86-166.btcentralplus.com. [86.166.87.213]) by mx.google.com with ESMTPSA id ei1sm1046575wib.20.2014.10.02.05.12.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Oct 2014 05:12:42 -0700 (PDT) Received: by trevor.secretlab.ca (Postfix, from userid 1000) id 4B443C417B4; Thu, 2 Oct 2014 05:12:15 -0700 (PDT) From: Grant Likely To: devicetree@vger.kernel.org Cc: Grant Likely Subject: [PATCH 1/2] of: Don't try to search when phandle == 0 Date: Thu, 2 Oct 2014 13:12:10 +0100 Message-Id: <1412251931-6640-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.178 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: , A value of '0' isn't a valid phandle, so searching for a node with that phandle is pointless. It will result in nothing but false positives. Signed-off-by: Grant Likely --- drivers/of/base.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 293ed4b687ba..2305dc0382bc 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1021,6 +1021,9 @@ struct device_node *of_find_node_by_phandle(phandle handle) struct device_node *np; unsigned long flags; + if (!handle) + return NULL; + raw_spin_lock_irqsave(&devtree_lock, flags); for (np = of_allnodes; np; np = np->allnext) if (np->phandle == handle)