Commit 6de00a5f authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Greg Kroah-Hartman

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: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Reported-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 8552ca0f
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment