aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing
diff options
context:
space:
mode:
authorSuzuki K Poulose <suzuki.poulose@arm.com>2018-09-20 13:17:39 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-25 20:09:17 +0200
commit5111e749c775ebae6f7d39c6f836cb3f06c7b938 (patch)
tree91ade35beb69abe0d1533c4664d5644b54934614 /drivers/hwtracing
parentcoresight: platform: Fix refcounting for graph nodes (diff)
downloadlinux-dev-5111e749c775ebae6f7d39c6f836cb3f06c7b938.tar.xz
linux-dev-5111e749c775ebae6f7d39c6f836cb3f06c7b938.zip
coresight: platform: Fix leaking device reference
We don't drop the reference on the remote device while parsing the connection, held by bus_find_device(). Fix this by duplicating the device name and dropping the reference. Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Kim Phillips <kim.phillips@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing')
-rw-r--r--drivers/hwtracing/coresight/of_coresight.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c
index 28d3aef1660b..4b279f8fea0c 100644
--- a/drivers/hwtracing/coresight/of_coresight.c
+++ b/drivers/hwtracing/coresight/of_coresight.c
@@ -162,7 +162,9 @@ static int of_coresight_parse_endpoint(struct device *dev,
}
pdata->outports[i] = endpoint.port;
- pdata->child_names[i] = dev_name(rdev);
+ pdata->child_names[i] = devm_kstrdup(dev,
+ dev_name(rdev),
+ GFP_KERNEL);
pdata->child_ports[i] = rendpoint.id;
/* Connection record updated */
ret = 1;
@@ -172,6 +174,8 @@ static int of_coresight_parse_endpoint(struct device *dev,
of_node_put(rparent);
if (rport)
of_node_put(rport);
+ if (rdev)
+ put_device(rdev);
return ret;
}