PM: EM: fix memory leak with using debugfs_lookup()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Feb 2023 15:15:15 +0000 (16:15 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 9 Feb 2023 19:36:10 +0000 (20:36 +0100)
commita0e8c13ccd6a9a636d27353da62c2410c4eca337
treeb937065cec7b61f03cc55323bf8aa0d9a0a78a31
parent4ec5183ec48656cec489c49f989c508b68b518e3
PM: EM: 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 <gregkh@linuxfoundation.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/power/energy_model.c