]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
greybus: raw: fix memory leak on disconnect
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 10 Feb 2016 10:08:29 +0000 (11:08 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 12 Feb 2016 05:46:03 +0000 (21:46 -0800)
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>
drivers/staging/greybus/raw.c

index fa5025dd17a3abfa621fc8951e60869c05d71327..a6e79599605370cc7c5f2b2b2ce5f1e58ca13496 100644 (file)
@@ -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);