linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-usb@vger.kernel.org, Rob Clark <robdclark@gmail.com>,
	Peter Robinson <pbrobinson@gmail.com>
Subject: [PATCH] usb: ulpi: Add missing of_node_get() in ulpi_of_register()
Date: Fri, 10 Nov 2017 17:43:00 -0800	[thread overview]
Message-ID: <20171111014300.2982-1-sboyd@codeaurora.org> (raw)

In ulpi_of_register() we call of_find_node_by_name() which
unconditionally calls of_node_put() on the 'from' argument. We
haven't called of_node_get() though, so we've put the node once
without getting it first. Add the of_node_get() call so that
things are properly balanced.

Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT")
Reported-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/usb/common/ulpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index 4aa5195db8ea..59e05eff76f9 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -182,9 +182,9 @@ static int ulpi_of_register(struct ulpi *ulpi)
 
 	/* Find a ulpi bus underneath the parent or the grandparent */
 	parent = ulpi->dev.parent;
-	if (parent->of_node)
+	if (of_node_get(parent->of_node))
 		np = of_find_node_by_name(parent->of_node, "ulpi");
-	else if (parent->parent && parent->parent->of_node)
+	else if (parent->parent && of_node_get(parent->parent->of_node))
 		np = of_find_node_by_name(parent->parent->of_node, "ulpi");
 	if (!np)
 		return 0;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

             reply	other threads:[~2017-11-11  1:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-11  1:43 Stephen Boyd [this message]
2017-11-11 15:25 ` [PATCH] usb: ulpi: Add missing of_node_get() in ulpi_of_register() Johan Hovold
2017-11-11 15:31 ` [PATCH] USB: ulpi: fix bus-node lookup Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171111014300.2982-1-sboyd@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pbrobinson@gmail.com \
    --cc=robdclark@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).