summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-22 10:21:07 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-03 09:49:07 -0400
commit2d146b924ec3c0873f06308d149684dc1105d9a3 (patch)
treef5848a499b5aaa75f58232e34141bc978d44c3ee
parentc4e41349a85c52456fea4903dde459302d54c67c (diff)
backing-dev: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. And as the return value does not matter at all, no need to save the dentry in struct backing_dev_info, so delete it. Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Anders Roxell <anders.roxell@linaro.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Michal Hocko <mhocko@suse.com> Cc: linux-mm@kvack.org Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--include/linux/backing-dev-defs.h1
-rw-r--r--mm/backing-dev.c24
2 files changed, 5 insertions, 20 deletions
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
index 07e02d6df5ad..6a1a8a314d85 100644
--- a/include/linux/backing-dev-defs.h
+++ b/include/linux/backing-dev-defs.h
@@ -203,7 +203,6 @@ struct backing_dev_info {
203 203
204#ifdef CONFIG_DEBUG_FS 204#ifdef CONFIG_DEBUG_FS
205 struct dentry *debug_dir; 205 struct dentry *debug_dir;
206 struct dentry *debug_stats;
207#endif 206#endif
208}; 207};
209 208
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 909dae445ea7..e8e89158adec 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -103,39 +103,25 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v)
103} 103}
104DEFINE_SHOW_ATTRIBUTE(bdi_debug_stats); 104DEFINE_SHOW_ATTRIBUTE(bdi_debug_stats);
105 105
106static int bdi_debug_register(struct backing_dev_info *bdi, const char *name) 106static void bdi_debug_register(struct backing_dev_info *bdi, const char *name)
107{ 107{
108 if (!bdi_debug_root)
109 return -ENOMEM;
110
111 bdi->debug_dir = debugfs_create_dir(name, bdi_debug_root); 108 bdi->debug_dir = debugfs_create_dir(name, bdi_debug_root);
112 if (!bdi->debug_dir)
113 return -ENOMEM;
114
115 bdi->debug_stats = debugfs_create_file("stats", 0444, bdi->debug_dir,
116 bdi, &bdi_debug_stats_fops);
117 if (!bdi->debug_stats) {
118 debugfs_remove(bdi->debug_dir);
119 bdi->debug_dir = NULL;
120 return -ENOMEM;
121 }
122 109
123 return 0; 110 debugfs_create_file("stats", 0444, bdi->debug_dir, bdi,
111 &bdi_debug_stats_fops);
124} 112}
125 113
126static void bdi_debug_unregister(struct backing_dev_info *bdi) 114static void bdi_debug_unregister(struct backing_dev_info *bdi)
127{ 115{
128 debugfs_remove(bdi->debug_stats); 116 debugfs_remove_recursive(bdi->debug_dir);
129 debugfs_remove(bdi->debug_dir);
130} 117}
131#else 118#else
132static inline void bdi_debug_init(void) 119static inline void bdi_debug_init(void)
133{ 120{
134} 121}
135static inline int bdi_debug_register(struct backing_dev_info *bdi, 122static inline void bdi_debug_register(struct backing_dev_info *bdi,
136 const char *name) 123 const char *name)
137{ 124{
138 return 0;
139} 125}
140static inline void bdi_debug_unregister(struct backing_dev_info *bdi) 126static inline void bdi_debug_unregister(struct backing_dev_info *bdi)
141{ 127{