summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/raw.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2016-02-10 11:08:29 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2016-02-11 21:46:03 -0800
commit397d34152423d2ddbff3e48495ef988cbb07776b (patch)
tree6854d0fe065965261c4640e75adfab71cde3b7db /drivers/staging/greybus/raw.c
parent8d46ec49819599d33ee5cffd43b19bf21f9472b8 (diff)
downloadop-kernel-dev-397d34152423d2ddbff3e48495ef988cbb07776b.zip
op-kernel-dev-397d34152423d2ddbff3e48495ef988cbb07776b.tar.gz
greybus: raw: fix memory leak on disconnect
Make sure the class device is freed as well as deregistered on disconnect. Also deregister the class device before character device as the former depends on the latter. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/raw.c')
-rw-r--r--drivers/staging/greybus/raw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/greybus/raw.c b/drivers/staging/greybus/raw.c
index fa5025d..a6e7959 100644
--- a/drivers/staging/greybus/raw.c
+++ b/drivers/staging/greybus/raw.c
@@ -203,9 +203,9 @@ static void gb_raw_connection_exit(struct gb_connection *connection)
struct raw_data *temp;
// FIXME - handle removing a connection when the char device node is open.
+ device_destroy(raw_class, raw->dev);
cdev_del(&raw->cdev);
ida_simple_remove(&minors, MINOR(raw->dev));
- device_del(raw->device);
mutex_lock(&raw->list_lock);
list_for_each_entry_safe(raw_data, temp, &raw->list, entry) {
list_del(&raw_data->entry);
OpenPOWER on IntegriCloud