diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-02-07 20:09:27 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-07 16:45:14 -0800 |
commit | 9e1ccb4a7700fcb3ddfe2767e0bbb6131f8ab54e (patch) | |
tree | b5036e6e0cff4f4264f02ca6991b342ed71cc4fe /drivers/base | |
parent | da9846ae15186d491d6e21ebbb5051e1d3c7f652 (diff) | |
download | linux-9e1ccb4a7700fcb3ddfe2767e0bbb6131f8ab54e.tar.bz2 |
drivers/base: fix devres handling for master device
We weren't handling the devres issues for the master device failing a
bind, or being unbound properly. Add a devres group to contain these,
and release the resources at the appropriate points.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/component.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/base/component.c b/drivers/base/component.c index c53efe6c6d8e..c4778995cd72 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -133,9 +133,16 @@ static int try_to_bring_up_master(struct master *master, goto out; } + if (!devres_open_group(master->dev, NULL, GFP_KERNEL)) { + ret = -ENOMEM; + goto out; + } + /* Found all components */ ret = master->ops->bind(master->dev); if (ret < 0) { + devres_release_group(master->dev, NULL); + dev_info(master->dev, "master bind failed: %d\n", ret); master_remove_components(master); goto out; } @@ -166,6 +173,7 @@ static void take_down_master(struct master *master) { if (master->bound) { master->ops->unbind(master->dev); + devres_release_group(master->dev, NULL); master->bound = false; } |