From patchwork Sat Oct 4 20:29:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 38352 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AA7DA203AD for ; Sat, 4 Oct 2014 20:30:56 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id d1sf504569wiv.10 for ; Sat, 04 Oct 2014 13:30:55 -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:in-reply-to:references: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=DEBA78xXo3Nr42xJCZT+RUEjPNncrIpSvutk1R2g8+g/cSnDrRaSzydA3wYPNHVl0h xI4BbaZcfjFSONK2uZ4bGuNlqrWc+UUSHG2jqqr9MIzG2LXbVKG+upKd4B9hT7N21ZK9 RgLkWx58OP/1el7cm7M6OQcUGtEYyvACyNw5GAGABmHQGu3EwiFEdWF8vydANSIqa1VU ht2dTAi4qlLaiAnbAzjw8PRVIzKldnDUp8MHsrYn/60hgBSCyBQNxwwuLFjRy8XEiXb9 qfr3gWQM+ZlGMwaaJfu3RzR6fnJLaeDPgqsAJUXNJz41jP9fiD/2Tr5GIsL5VKTZVouT 2neg== X-Gm-Message-State: ALoCoQlcw0LugQmAGjbkkl/Bywhp74TjDA0An7ww1acFgpbeTzVVzVDW4OMFil8xUdPcISL5XIcR X-Received: by 10.180.82.74 with SMTP id g10mr1692793wiy.0.1412454655911; Sat, 04 Oct 2014 13:30:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.9 with SMTP id o9ls407279lao.97.gmail; Sat, 04 Oct 2014 13:30:55 -0700 (PDT) X-Received: by 10.112.145.100 with SMTP id st4mr13670059lbb.17.1412454655562; Sat, 04 Oct 2014 13:30:55 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com [209.85.215.47]) by mx.google.com with ESMTPS id jd2si12962459lbc.91.2014.10.04.13.30.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 04 Oct 2014 13:30:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id pv20so2676883lab.34 for ; Sat, 04 Oct 2014 13:30:55 -0700 (PDT) X-Received: by 10.152.7.73 with SMTP id h9mr14304967laa.27.1412454655450; Sat, 04 Oct 2014 13:30:55 -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 of9csp76220lbb; Sat, 4 Oct 2014 13:30:54 -0700 (PDT) X-Received: by 10.68.105.197 with SMTP id go5mr14780024pbb.73.1412454653526; Sat, 04 Oct 2014 13:30:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pl6si7343357pdb.111.2014.10.04.13.30.52 for ; Sat, 04 Oct 2014 13:30:53 -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 S1751056AbaJDUaw (ORCPT + 5 others); Sat, 4 Oct 2014 16:30:52 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:54768 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750943AbaJDUav (ORCPT ); Sat, 4 Oct 2014 16:30:51 -0400 Received: by mail-wi0-f180.google.com with SMTP id em10so1564855wid.1 for ; Sat, 04 Oct 2014 13:30:49 -0700 (PDT) X-Received: by 10.180.102.7 with SMTP id fk7mr7693896wib.77.1412454649826; Sat, 04 Oct 2014 13:30:49 -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 wu10sm3741227wjb.8.2014.10.04.13.30.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Oct 2014 13:30:49 -0700 (PDT) Received: by trevor.secretlab.ca (Postfix, from userid 1000) id 34FF6C41FD3; Sat, 4 Oct 2014 13:30:13 -0700 (PDT) From: Grant Likely To: devicetree@vger.kernel.org Cc: Grant Likely Subject: [PATCH v2 3/6] of: Don't try to search when phandle == 0 Date: Sat, 4 Oct 2014 21:29:59 +0100 Message-Id: <1412454602-28518-3-git-send-email-grant.likely@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1412454602-28518-1-git-send-email-grant.likely@linaro.org> References: <1412454602-28518-1-git-send-email-grant.likely@linaro.org> 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.215.47 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)