Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324358
b: refs/heads/master
c: a525a3d
h: refs/heads/master
v: v3
  • Loading branch information
Ming Lei authored and Greg Kroah-Hartman committed Aug 16, 2012
1 parent 2057cef commit 5aec861
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2221f6ef71d4b89ed56a233cc0200bbe9b84a385
refs/heads/master: a525a3ddeaca69f405d98442ab3c0746e53168dc
18 changes: 11 additions & 7 deletions trunk/drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@ static void device_release(struct kobject *kobj)
struct device *dev = kobj_to_dev(kobj);
struct device_private *p = dev->p;

/*
* Some platform devices are driven without driver attached
* and managed resources may have been acquired. Make sure
* all resources are released.
*
* Drivers still can add resources into device after device
* is deleted but alive, so release devres here to avoid
* possible memory leak.
*/
devres_release_all(dev);

if (dev->release)
dev->release(dev);
else if (dev->type && dev->type->release)
Expand Down Expand Up @@ -1196,13 +1207,6 @@ void device_del(struct device *dev)
bus_remove_device(dev);
driver_deferred_probe_del(dev);

/*
* Some platform devices are driven without driver attached
* and managed resources may have been acquired. Make sure
* all resources are released.
*/
devres_release_all(dev);

/* Notify the platform of the removal, in case they
* need to do anything...
*/
Expand Down

0 comments on commit 5aec861

Please sign in to comment.