mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 06:14:39 +01:00
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
1 parent
da9846ae15
commit
9e1ccb4a77
1 file changed
+8
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user