From patchwork Wed Nov 15 11:07:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10059171 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D661E60231 for ; Wed, 15 Nov 2017 11:07:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BACEB29E8F for ; Wed, 15 Nov 2017 11:07:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AABAA29E70; Wed, 15 Nov 2017 11:07:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25A2629E70 for ; Wed, 15 Nov 2017 11:07:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756168AbdKOLH3 (ORCPT ); Wed, 15 Nov 2017 06:07:29 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:56815 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755147AbdKOLH2 (ORCPT ); Wed, 15 Nov 2017 06:07:28 -0500 Received: by mail-lf0-f66.google.com with SMTP id g35so11478060lfi.13; Wed, 15 Nov 2017 03:07:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=rT88qFihHySbWXBodnxIPnhew1lG7SRYrJMQL05B5Jk=; b=Uf42IMq8jP+zSTAzkassQ4ZrkZ7IWD+Usb8JNM02Kgt1DgfCPSncVsRiZFK/CJA1li NuO2GCQWeZfLag/3vatNgv1K3cZeP9VYB0gtVck24aKroD8d92VYET6HNhYQmPcnTkJi y/9+wPBZ+Mz8niLH1bztUqL8ov1Q2LVSZ65pHtAswDh8Ma9/uyjHvCjCkWG3HkCfewlM T07PSjCDiMOEz1Vl5UFtkQpyKDWxaP0WafiIxyNgsPMW6jIC/akY4M/R5EcoLEtvh3AF XhiXrU2QVPSOhKBFeOLayRPeKKnz1v/7Ax3dn/TIyoMYx2KbG+NChSCDuXtT2rMQevdN PC+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=rT88qFihHySbWXBodnxIPnhew1lG7SRYrJMQL05B5Jk=; b=tMe03iXbDEDfjFZ20NNAfUR7KyPVZm1+JxEO46meNupwdP0CNGI+BTnlXLtdQLtPW7 o821Q3EIPO75mtNGpRxi52O1sjKYbLNKE/PnspJAwVYxx/SG8DmV7JjrtNoVZZa5X6Qu +Eb4KvkUA2m53soIDkj6B+CWllfZzZjF2Zemyo6mUF4wNyesZMHP09t0DGK1fb8v/4lR 4YMIItzJDlED5IZjLShP+sqRRIC14Dow7m8cPGlABMY1VVnKvHOv8njSXD1K/uyUBmbh YHCWRqMqI1wT6QWwKnbNM0o92Brl/SbsSrG2MSaLgVoleHDWpDu+r/r/62cGGpUlNg7e L5yQ== X-Gm-Message-State: AJaThX685Ml9vAhDQHCFKbk3Qv3KGDpCWANdJ+ptcxBnFU7f5qpFeB1v /CxjAanc+KpCiUGF1DleJs5TjFoV X-Google-Smtp-Source: AGs4zMZorMS+RkAWxKDS14arnsBcHmusHZ5ZmvPziVFxmn9wlb4j0j95GgxCyiRsBHquinGh6uEfnw== X-Received: by 10.46.25.87 with SMTP id p84mr6835972lje.67.1510744046820; Wed, 15 Nov 2017 03:07:26 -0800 (PST) Received: from xi.terra (c-c0bae655.07-184-6d6c6d4.cust.bredbandsbolaget.se. [85.230.186.192]) by smtp.gmail.com with ESMTPSA id w7sm1357728ljd.95.2017.11.15.03.07.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 03:07:26 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.89) (envelope-from ) id 1eEvXY-0004tg-5B; Wed, 15 Nov 2017 12:07:32 +0100 From: Johan Hovold To: Andy Gross Cc: David Brown , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , Bjorn Andersson , Rob Clark Subject: [PATCH] soc: qcom: smsm: fix child-node lookup Date: Wed, 15 Nov 2017 12:07:24 +0100 Message-Id: <20171115110724.18784-1-johan@kernel.org> X-Mailer: git-send-email 2.15.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix child-node lookup during probe, which ended up searching the whole device tree depth-first starting at the parent rather than just matching on its children. Note that the original premature free of the parent node has already been fixed separately. Also note that this pattern of looking up the first child node with a given property is rare enough that a generic helper is probably not warranted. Fixes: c97c4090ff72 ("soc: qcom: smsm: Add driver for Qualcomm SMSM") Fixes: 3e8b55411468 ("soc: qcom: smsm: fix of_node refcnting problem") Cc: Bjorn Andersson Cc: Rob Clark Signed-off-by: Johan Hovold Reviewed-by: Bjorn Andersson --- drivers/soc/qcom/smsm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c index 403bea9d546b..50214b620865 100644 --- a/drivers/soc/qcom/smsm.c +++ b/drivers/soc/qcom/smsm.c @@ -496,8 +496,10 @@ static int qcom_smsm_probe(struct platform_device *pdev) if (!smsm->hosts) return -ENOMEM; - local_node = of_find_node_with_property(of_node_get(pdev->dev.of_node), - "#qcom,smem-state-cells"); + for_each_child_of_node(pdev->dev.of_node, local_node) { + if (of_find_property(local_node, "#qcom,smem-state-cells", NULL)) + break; + } if (!local_node) { dev_err(&pdev->dev, "no state entry\n"); return -EINVAL;