]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drivers: vmw_balloon: remove dentry pointer for debugfs
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Feb 2021 15:12:09 +0000 (16:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Mar 2021 08:21:02 +0000 (09:21 +0100)
There is no need to keep the dentry pointer around for the created
debugfs file, as it is only needed when removing it from the system.
When it is to be removed, ask debugfs itself for the pointer, to save on
storage and make things a bit simpler.

Cc: Nadav Amit <namit@vmware.com>
Cc: "VMware, Inc." <pv-drivers@vmware.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-kernel@vger.kernel.org
Acked-by: Nadav Amit <namit@vmware.com>
Link: https://lore.kernel.org/r/20210216151209.3954129-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/vmw_balloon.c

index b837e7eba5f7dcec2ae1f15bb2052c18b9a0f306..f1d8ba6d485741336d48382dc00dd2d59f4fe630 100644 (file)
@@ -346,11 +346,6 @@ struct vmballoon {
        /* statistics */
        struct vmballoon_stats *stats;
 
-#ifdef CONFIG_DEBUG_FS
-       /* debugfs file exporting statistics */
-       struct dentry *dbg_entry;
-#endif
-
        /**
         * @b_dev_info: balloon device information descriptor.
         */
@@ -1709,14 +1704,14 @@ DEFINE_SHOW_ATTRIBUTE(vmballoon_debug);
 
 static void __init vmballoon_debugfs_init(struct vmballoon *b)
 {
-       b->dbg_entry = debugfs_create_file("vmmemctl", S_IRUGO, NULL, b,
-                                          &vmballoon_debug_fops);
+       debugfs_create_file("vmmemctl", S_IRUGO, NULL, b,
+                           &vmballoon_debug_fops);
 }
 
 static void __exit vmballoon_debugfs_exit(struct vmballoon *b)
 {
        static_key_disable(&balloon_stat_enabled.key);
-       debugfs_remove(b->dbg_entry);
+       debugfs_remove(debugfs_lookup("vmmemctl", NULL));
        kfree(b->stats);
        b->stats = NULL;
 }