Skip to content

Commit 0b6200e

Browse files
gregkhrafaeljw
authored andcommitted
PM: domains: fix memory leak with using debugfs_lookup()
When calling debugfs_lookup() the result must have dput() called on it, otherwise the memory will leak over time. To make things simpler, just call debugfs_lookup_and_remove() instead which handles all of the logic at once. Signed-off-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 4ec5183 commit 0b6200e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/base/power/domain.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,10 @@ static void genpd_debug_add(struct generic_pm_domain *genpd);
220220

221221
static void genpd_debug_remove(struct generic_pm_domain *genpd)
222222
{
223-
struct dentry *d;
224-
225223
if (!genpd_debugfs_dir)
226224
return;
227225

228-
d = debugfs_lookup(genpd->name, genpd_debugfs_dir);
229-
debugfs_remove(d);
226+
debugfs_lookup_and_remove(genpd->name, genpd_debugfs_dir);
230227
}
231228

232229
static void genpd_update_accounting(struct generic_pm_domain *genpd)

0 commit comments

Comments
 (0)