Skip to content

Commit 9e1ccb4

Browse files
Russell Kinggregkh
authored andcommitted
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>
1 parent da9846a commit 9e1ccb4

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎drivers/base/component.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,16 @@ static int try_to_bring_up_master(struct master *master,
133133
goto out;
134134
}
135135

136+
if (!devres_open_group(master->dev, NULL, GFP_KERNEL)) {
137+
ret = -ENOMEM;
138+
goto out;
139+
}
140+
136141
/* Found all components */
137142
ret = master->ops->bind(master->dev);
138143
if (ret < 0) {
144+
devres_release_group(master->dev, NULL);
145+
dev_info(master->dev, "master bind failed: %d\n", ret);
139146
master_remove_components(master);
140147
goto out;
141148
}
@@ -166,6 +173,7 @@ static void take_down_master(struct master *master)
166173
{
167174
if (master->bound) {
168175
master->ops->unbind(master->dev);
176+
devres_release_group(master->dev, NULL);
169177
master->bound = false;
170178
}
171179

0 commit comments

Comments
 (0)