summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/loopback.c
diff options
context:
space:
mode:
authorBryan O'Donoghue2015-09-14 11:48:39 +0200
committerGreg Kroah-Hartman2015-09-15 06:35:58 +0200
commit6de00a5f32e09b58879175f2942ebeac699d3534 (patch)
treea525e6f858503f1a351dc72261f4f2c86b478c7e /drivers/staging/greybus/loopback.c
parentgreybus: connection: Add sysfs 'ap_cport_id' file for connections (diff)
downloadkernel-qcow2-linux-6de00a5f32e09b58879175f2942ebeac699d3534.tar.gz
kernel-qcow2-linux-6de00a5f32e09b58879175f2942ebeac699d3534.tar.xz
kernel-qcow2-linux-6de00a5f32e09b58879175f2942ebeac699d3534.zip
greybus: loopback: ensure count decrement happens before sysfs_remove_groups
This patches fixes a case where gb_dev.count is decremented too late in the exit() routine. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reported-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-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.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
index 231d1d4c1104..33c21cf22687 100644
--- a/drivers/staging/greybus/loopback.c
+++ b/drivers/staging/greybus/loopback.c
@@ -952,14 +952,13 @@ static void gb_loopback_connection_exit(struct gb_connection *connection)
connection->private = NULL;
kfifo_free(&gb->kfifo_lat);
kfifo_free(&gb->kfifo_ts);
+ gb_dev.count--;
if (!gb_dev.count)
sysfs_remove_groups(kobj, loopback_dev_groups);
sysfs_remove_groups(&connection->dev.kobj, loopback_con_groups);
debugfs_remove(gb->file);
list_del(&gb->entry);
kfree(gb);
- gb_dev.count--;
-
mutex_unlock(&gb_dev.mutex);
}