diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-06-04 18:16:45 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-06-09 13:31:23 -0700 |
commit | 928f2abd5ff12fa4851b762df7c32e749e846b7c (patch) | |
tree | 68fb3fc47c0a657ef41471bca2709eb5ac3c9a9a /drivers/staging/greybus/bundle.c | |
parent | d51c0ffb5cd1e92884e847f2cac6935c6d866779 (diff) |
greybus: Tear down devices in the reverse order
Normally, its a good practice to free resources in the reverse order in
which they are allocated, so that all the dependencies can be sorted out
properly.
This is true while creating/destroying devices as well. For example
consider this scenario (I faced a crash with control protocol due to
this). For a new module, we will first create a bundle+connection for
the control cport and then create other bundles/connections after
parsing manifest.
And while destroying interface on module hot unplug, we are removing the
devices in the order they are added. And so the bundle/connection for
the control cport are destroyed first. But, control cport was still
required while destroying other bundles/connections.
To solve this problem, lets destroy the resources in the reverse order
in which they are added.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/bundle.c')
-rw-r--r-- | drivers/staging/greybus/bundle.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/greybus/bundle.c b/drivers/staging/greybus/bundle.c index 2047e173ebd9..a6b1b347097a 100644 --- a/drivers/staging/greybus/bundle.c +++ b/drivers/staging/greybus/bundle.c @@ -196,7 +196,7 @@ struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id, } spin_lock_irq(&gb_bundles_lock); - list_add_tail(&bundle->links, &intf->bundles); + list_add(&bundle->links, &intf->bundles); spin_unlock_irq(&gb_bundles_lock); return bundle; |