[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1530797585-8555-7-git-send-email-todor.tomov@linaro.org>
Date: Thu, 5 Jul 2018 16:32:37 +0300
From: Todor Tomov <todor.tomov@...aro.org>
To: mchehab@...nel.org, sakari.ailus@...ux.intel.com,
hans.verkuil@...co.com, laurent.pinchart+renesas@...asonboard.com,
linux-media@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Todor Tomov <todor.tomov@...aro.org>
Subject: [PATCH v2 06/34] media: camss: Fix OF node usage
of_graph_get_next_endpoint increases the refcount of the returned
node and decreases the refcount of the passed node. Take this into
account and use of_node_put properly.
Signed-off-by: Todor Tomov <todor.tomov@...aro.org>
---
drivers/media/platform/qcom/camss/camss.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index 45285eb..abf6184 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -296,6 +296,7 @@ static int camss_of_parse_ports(struct device *dev,
if (of_device_is_available(node))
notifier->num_subdevs++;
+ of_node_put(node);
size = sizeof(*notifier->subdevs) * notifier->num_subdevs;
notifier->subdevs = devm_kzalloc(dev, size, GFP_KERNEL);
if (!notifier->subdevs) {
@@ -326,16 +327,16 @@ static int camss_of_parse_ports(struct device *dev,
}
remote = of_graph_get_remote_port_parent(node);
- of_node_put(node);
-
if (!remote) {
dev_err(dev, "Cannot get remote parent\n");
+ of_node_put(node);
return -EINVAL;
}
csd->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
csd->asd.match.fwnode = of_fwnode_handle(remote);
}
+ of_node_put(node);
return notifier->num_subdevs;
}
--
2.7.4
Powered by blists - more mailing lists