PM: domains: fix memory leak with using debugfs_lookup()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Feb 2023 14:15:45 +0000 (15:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:52 +0000 (09:33 +0100)
commitcde67cb7d2d1757baa83271c1f0892727e79f52e
tree4c5ca9bd99fc120de8aa2c4441dc318fdbf44a20
parent15cffd01ed80e3506e29ba9f441e2358413b7317
PM: domains: fix memory leak with using debugfs_lookup()

[ Upstream commit 0b6200e1e9f53dabdc30d0f6c51af9a5f664d32b ]

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 <gregkh@linuxfoundation.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/base/power/domain.c