From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bjorn Andersson Subject: Re: [PATCH] soc: qcom: smsm: fix child-node lookup Date: Wed, 15 Nov 2017 22:17:09 -0800 Message-ID: <20171116061709.GL28761@minitux> References: <20171115110724.18784-1-johan@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail-pg0-f65.google.com ([74.125.83.65]:51231 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754569AbdKPGRM (ORCPT ); Thu, 16 Nov 2017 01:17:12 -0500 Received: by mail-pg0-f65.google.com with SMTP id p9so19854853pgc.8 for ; Wed, 15 Nov 2017 22:17:12 -0800 (PST) Content-Disposition: inline In-Reply-To: <20171115110724.18784-1-johan@kernel.org> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: Johan Hovold Cc: Andy Gross , David Brown , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark On Wed 15 Nov 03:07 PST 2017, Johan Hovold wrote: > 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. > I agree. > 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 Thanks, Bjorn > --- > 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; > -- > 2.15.0 >