From patchwork Tue Mar 17 16:14:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 45885 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C85702153C for ; Tue, 17 Mar 2015 16:14:06 +0000 (UTC) Received: by labgm9 with SMTP id gm9sf2700110lab.1 for ; Tue, 17 Mar 2015 09:14:05 -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=UZ0GOBjxOuTO7RudJjt7rpwICUTJyUNDfo3gE6gfh4M=; b=GIFCN+0lJ65ip0ukMBMYBKhM/2wP1zRR+UKsxyb6EHUjK0+PJ+7JFZrRYme4z2hnnf X6nyt6dDIo8wihFPOB0i1xHwNTbTXJTdNSflSSVtLQ4eswmlAj3frFRkm/p+2AKB/G/A vjeSP8ZsdI3fmndz4etY4Vz3M8G1DZtuRiwACpn6WMYaIiJ47hdb4XqU3WnHJRiaNQIC T8IRMalFUim9GI/txqqDheM6p2gHYiAnCvIegCf+Rd9RW+Z4TG8Yph18Jy7bk63W2nJy 3BkBLG+PPZiaJHeU7xoQ36ifBCbdPvHUuEP5tyW6uAKr8XnT/R4QhhJZiIaXRRvQ3R/g K/yA== X-Gm-Message-State: ALoCoQnTFK1ZUvM4HSOCB4vv4YYYydaoRs7KUEsy+D5AHLg1XvlMW0/Ydznw6FLLvp6LWteQecFN X-Received: by 10.180.182.201 with SMTP id eg9mr6384076wic.3.1426608845837; Tue, 17 Mar 2015 09:14:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.237 with SMTP id r13ls64445lal.74.gmail; Tue, 17 Mar 2015 09:14:05 -0700 (PDT) X-Received: by 10.152.2.105 with SMTP id 9mr38506928lat.16.1426608845478; Tue, 17 Mar 2015 09:14:05 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id o7si10887061laj.32.2015.03.17.09.14.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Mar 2015 09:14:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lagg8 with SMTP id g8so12995911lag.1 for ; Tue, 17 Mar 2015 09:14:05 -0700 (PDT) X-Received: by 10.112.130.195 with SMTP id og3mr59550838lbb.112.1426608845332; Tue, 17 Mar 2015 09:14:05 -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.35.133 with SMTP id h5csp612365lbj; Tue, 17 Mar 2015 09:14:04 -0700 (PDT) X-Received: by 10.66.154.17 with SMTP id vk17mr150200906pab.5.1426608843546; Tue, 17 Mar 2015 09:14:03 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kl7si30156768pdb.199.2015.03.17.09.14.02; Tue, 17 Mar 2015 09:14:03 -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 S1753823AbbCQQOB (ORCPT + 5 others); Tue, 17 Mar 2015 12:14:01 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:34050 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754115AbbCQQOA (ORCPT ); Tue, 17 Mar 2015 12:14:00 -0400 Received: by wibg7 with SMTP id g7so49406274wib.1 for ; Tue, 17 Mar 2015 09:13:59 -0700 (PDT) X-Received: by 10.194.179.41 with SMTP id dd9mr136290270wjc.72.1426608839628; Tue, 17 Mar 2015 09:13:59 -0700 (PDT) Received: from mohikan.mushroom.smurfnet.nu (cpc4-cmbg17-2-0-cust71.5-4.cable.virginm.net. [86.14.224.72]) by mx.google.com with ESMTPSA id dx11sm20554900wjb.23.2015.03.17.09.13.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Mar 2015 09:13:58 -0700 (PDT) From: Leif Lindholm To: devicetree@vger.kernel.org Cc: robh@kernel.org, hdegoede@redhat.com, peter@hurleysoftware.com, grant.likely@linaro.org Subject: [PATCH 1/2] Revert "of: fix handling of '/' in options for of_find_node_by_path()" Date: Tue, 17 Mar 2015 16:14:52 +0000 Message-Id: <1426608893-3739-2-git-send-email-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1426608893-3739-1-git-send-email-leif.lindholm@linaro.org> References: <1426608893-3739-1-git-send-email-leif.lindholm@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: leif.lindholm@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.49 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: , This reverts commit 106937e8ccdc ("of: fix handling of '/' in options for of_find_node_by_path()") This fix breaks handling of strings containing both ':' and '/'. Signed-off-by: Leif Lindholm Fixes: 106937e8ccdc --- drivers/of/base.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index adb8764..3b1aa08 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -714,17 +714,16 @@ static struct device_node *__of_find_node_by_path(struct device_node *parent, const char *path) { struct device_node *child; - int len; - const char *end; + int len = strchrnul(path, '/') - path; + int term; - end = strchr(path, ':'); - if (!end) - end = strchrnul(path, '/'); - - len = end - path; if (!len) return NULL; + term = strchrnul(path, ':') - path; + if (term < len) + len = term; + __for_each_child_of_node(parent, child) { const char *name = strrchr(child->full_name, '/'); if (WARN(!name, "malformed device_node %s\n", child->full_name)) @@ -769,12 +768,8 @@ struct device_node *of_find_node_opts_by_path(const char *path, const char **opt /* The path could begin with an alias */ if (*path != '/') { - int len; - const char *p = separator; - - if (!p) - p = strchrnul(path, '/'); - len = p - path; + char *p = strchrnul(path, '/'); + int len = separator ? separator - path : p - path; /* of_aliases must not be NULL */ if (!of_aliases) @@ -799,8 +794,6 @@ struct device_node *of_find_node_opts_by_path(const char *path, const char **opt path++; /* Increment past '/' delimiter */ np = __of_find_node_by_path(np, path); path = strchrnul(path, '/'); - if (separator && separator < path) - break; } raw_spin_unlock_irqrestore(&devtree_lock, flags); return np;