Re: [PATCH v4 05/14] coresight: get/put module in coresight_build/release_path

From: Suzuki K Poulose
Date: Thu Jun 07 2018 - 05:43:26 EST


On 06/06/2018 09:55 PM, Kim Phillips wrote:
On Wed, 6 Jun 2018 10:46:36 +0100
Suzuki K Poulose <suzuki.poulose@xxxxxxx> wrote:


And while we are at this, I also realised that we hold references to the
parent devices for each connection (via bus_find_device() from
of_coresight_get_endpoint_device()), while parsing the platform data,
which is never released.

Would this fix that?:

Not completely. We store the dev_name() as a reference, which itself can be free'd, when the device is gone. I have a fix for this in my next
version of the DT clean up series [0], where I clean up most of the
platform parsing code.


[0] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-June/582904.html

Cheers
Suzuki


diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c
index a33a92ebe74b..a43ab078c85e 100644
--- a/drivers/hwtracing/coresight/of_coresight.c
+++ b/drivers/hwtracing/coresight/of_coresight.c
@@ -181,6 +181,8 @@ of_get_coresight_platform_data(struct device *dev,
pdata->child_names[i] = dev_name(rdev);
pdata->child_ports[i] = rendpoint.id;
+ put_device(rdev);
+
i++;
} while (ep);
}