summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/loopback.c
diff options
context:
space:
mode:
authorBryan O'Donoghue2015-09-14 11:48:42 +0200
committerGreg Kroah-Hartman2015-09-15 06:35:58 +0200
commitc7ea5ed6f2790240a8ddaf98905a9465a37e839e (patch)
treeb90612cb54af5681d09eb6d5b6ac8d85151c15aa /drivers/staging/greybus/loopback.c
parentgreybus: loopback: exit kfree after mutex release (diff)
downloadkernel-qcow2-linux-c7ea5ed6f2790240a8ddaf98905a9465a37e839e.tar.gz
kernel-qcow2-linux-c7ea5ed6f2790240a8ddaf98905a9465a37e839e.tar.xz
kernel-qcow2-linux-c7ea5ed6f2790240a8ddaf98905a9465a37e839e.zip
greybus: loopback: ensure debugfs entires are cleaned up on exit
bdd4bba4 ('greybus/loopback: add module level sys/debug fs data points') added a debugfs entry attached to gb_dev but omitted the cleanup on gb_init error and gb_exit. This patchs fixes the missing debugfs_remove(). Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reported-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/loopback.c')
-rw-r--r--drivers/staging/greybus/loopback.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
index 745490af7e47..8bfeec8f71a0 100644
--- a/drivers/staging/greybus/loopback.c
+++ b/drivers/staging/greybus/loopback.c
@@ -34,6 +34,7 @@ struct gb_loopback_stats {
struct gb_loopback_device {
struct dentry *root;
+ struct dentry *file;
u32 count;
struct kfifo kfifo;
@@ -860,9 +861,9 @@ static int gb_loopback_connection_init(struct gb_connection *connection)
if (!gb_dev.count) {
snprintf(name, sizeof(name), "raw_latency_endo0:%d",
connection->bundle->intf->module->module_id);
- debugfs_create_file(name, S_IFREG | S_IRUGO,
- gb_dev.root, &gb_dev,
- &gb_loopback_debugfs_dev_latency_ops);
+ gb_dev.file = debugfs_create_file(name, S_IFREG | S_IRUGO,
+ gb_dev.root, &gb_dev,
+ &gb_loopback_debugfs_dev_latency_ops);
retval = sysfs_create_groups(kobj, loopback_dev_groups);
if (retval)
goto out_sysfs;
@@ -925,8 +926,10 @@ out_kfifo0:
out_sysfs_conn:
sysfs_remove_groups(&connection->dev.kobj, loopback_con_groups);
out_sysfs_dev:
- if (!gb_dev.count)
+ if (!gb_dev.count) {
sysfs_remove_groups(kobj, loopback_dev_groups);
+ debugfs_remove(gb_dev.file);
+ }
debugfs_remove(gb->file);
connection->private = NULL;
out_sysfs:
@@ -950,8 +953,10 @@ static void gb_loopback_connection_exit(struct gb_connection *connection)
kfifo_free(&gb->kfifo_lat);
kfifo_free(&gb->kfifo_ts);
gb_dev.count--;
- if (!gb_dev.count)
+ if (!gb_dev.count) {
sysfs_remove_groups(kobj, loopback_dev_groups);
+ debugfs_remove(gb_dev.file);
+ }
sysfs_remove_groups(&connection->dev.kobj, loopback_con_groups);
debugfs_remove(gb->file);
list_del(&gb->entry);