tty: pcn_uart: fix memory leak with using debugfs_lookup()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Feb 2023 14:12:21 +0000 (15:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 12:57:37 +0000 (13:57 +0100)
commitcf042964c2fa72950bbbf25b2cdd732b873e89db
tree06235b307de9f6008de4f0d6359b6d28a5f7f751
parent49ae24f44713d345952f585d33f6b0074a18a539
tty: pcn_uart: fix memory leak with using debugfs_lookup()

[ Upstream commit 04a189c720aa2b6091442113ce9b9bc93552dff8 ]

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.

Cc: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20230202141221.2293012-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/pch_uart.c