mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-04 08:04:24 -04:00
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8d46ec4981
commit
397d341524
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user