On 08/06/18 20:55, Mathieu Poirier wrote:
On Tue, Jun 05, 2018 at 10:43:13PM +0100, Suzuki K Poulose wrote:
The coresight driver doesn't drop the references on the
remote endpoint/port nodes. Add the missing of_node_put()
calls. To make it easier to handle different corner cases
cleanly, move the parsing of an endpoint to separate
function.
Please split this as those are two different things.
Mathieu,
I can do that, its only that if someone were to backport
the fix for an older kernel, they would need to pick up these
two patches, which is still fine.
Reported-by: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
---
drivers/hwtracing/coresight/of_coresight.c | 139 +++++++++++++++++------------
1 file changed, 84 insertions(+), 55 deletions(-)
diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c
index a33a92e..8a23c63 100644
--- a/drivers/hwtracing/coresight/of_coresight.c
+++ b/drivers/hwtracing/coresight/of_coresight.c
+static int of_coresight_parse_endpoint(struct device_node *ep,
+ struct coresight_platform_data *pdata,
+ int *i)
+{
+ int ret = 0;
+ struct of_endpoint endpoint, rendpoint;
+ struct device_node *rparent = NULL;
+ struct device_node *rport = NULL;
+ struct device *rdev = NULL;
+
+ do {
...
+ } while (0);
That's a clever way of coding a classic 'goto' block.
+
+ if (rparent)
+ of_node_put(rparent);
+ if (rport)
+ of_node_put(rport);
Perfect - thank you for that.
pdata->name = dev_name(dev);
+ pdata->cpu = of_coresight_get_cpu(node);
/* Get the number of input and output port for this component */
of_coresight_get_ports(node, &pdata->nr_inport, &pdata->nr_outport);
- if (pdata->nr_outport) {
- ret = of_coresight_alloc_memory(dev, pdata);
+ /* If there are not output connections, we are done */
/not/no
Thanks for spotting.
Suzuki
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html