aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index f338037a4f3d..c8fe4a563866 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -184,6 +184,17 @@ static void device_release(struct kobject *kobj)
184 struct device *dev = kobj_to_dev(kobj); 184 struct device *dev = kobj_to_dev(kobj);
185 struct device_private *p = dev->p; 185 struct device_private *p = dev->p;
186 186
187 /*
188 * Some platform devices are driven without driver attached
189 * and managed resources may have been acquired. Make sure
190 * all resources are released.
191 *
192 * Drivers still can add resources into device after device
193 * is deleted but alive, so release devres here to avoid
194 * possible memory leak.
195 */
196 devres_release_all(dev);
197
187 if (dev->release) 198 if (dev->release)
188 dev->release(dev); 199 dev->release(dev);
189 else if (dev->type && dev->type->release) 200 else if (dev->type && dev->type->release)
@@ -1196,13 +1207,6 @@ void device_del(struct device *dev)
1196 bus_remove_device(dev); 1207 bus_remove_device(dev);
1197 driver_deferred_probe_del(dev); 1208 driver_deferred_probe_del(dev);
1198 1209
1199 /*
1200 * Some platform devices are driven without driver attached
1201 * and managed resources may have been acquired. Make sure
1202 * all resources are released.
1203 */
1204 devres_release_all(dev);
1205
1206 /* Notify the platform of the removal, in case they 1210 /* Notify the platform of the removal, in case they
1207 * need to do anything... 1211 * need to do anything...
1208 */ 1212 */