History

iommu/omap: 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.

Greg Kroah-Hartman committed 7 years ago

Commit 9378bfe1 parent 6e8b5661 file · +6 −29Browse files

Unified · Split

drivers/iommu/omap-iommu-debug.c+6−29
@@ -239,17 +239,6 @@ DEBUG_FOPS_RO(regs); · 238 unmodified lines
239DEFINE_SHOW_ATTRIBUTE(tlb);239DEFINE_SHOW_ATTRIBUTE(tlb);
240DEFINE_SHOW_ATTRIBUTE(pagetable);240DEFINE_SHOW_ATTRIBUTE(pagetable);
241 241
242#define __DEBUG_ADD_FILE(attr, mode) \
243 { \
244 struct dentry *dent; \
245 dent = debugfs_create_file(#attr, mode, obj->debug_dir, \
246 obj, &attr##_fops); \
247 if (!dent) \
248 goto err; \
249 }
250
251#define DEBUG_ADD_FILE_RO(name) __DEBUG_ADD_FILE(name, 0400)
252
253void omap_iommu_debugfs_add(struct omap_iommu *obj)242void omap_iommu_debugfs_add(struct omap_iommu *obj)
254{243{
255 struct dentry *d;244 struct dentry *d;
@@ -257,23 +246,13 @@ void omap_iommu_debugfs_add(struct omap_iommu *obj) · 1 unmodified line
257 if (!iommu_debug_root)246 if (!iommu_debug_root)
258 return;247 return;
259 248
260 obj->debug_dir = debugfs_create_dir(obj->name, iommu_debug_root);249 d = debugfs_create_dir(obj->name, iommu_debug_root);
261 if (!obj->debug_dir)250 obj->debug_dir = d;
262 return;
263 251
264 d = debugfs_create_u32("nr_tlb_entries", 0400, obj->debug_dir,252 debugfs_create_u32("nr_tlb_entries", 0400, d, &obj->nr_tlb_entries);
265 &obj->nr_tlb_entries);253 debugfs_create_file("regs", 0400, d, obj, &regs_fops);
266 if (!d)254 debugfs_create_file("tlb", 0400, d, obj, &tlb_fops);
267 return;255 debugfs_create_file("pagetable", 0400, d, obj, &pagetable_fops);
268
269 DEBUG_ADD_FILE_RO(regs);
270 DEBUG_ADD_FILE_RO(tlb);
271 DEBUG_ADD_FILE_RO(pagetable);
272
273 return;
274
275err:
276 debugfs_remove_recursive(obj->debug_dir);
277}256}
278 257
279void omap_iommu_debugfs_remove(struct omap_iommu *obj)258void omap_iommu_debugfs_remove(struct omap_iommu *obj)
@@ -287,8 +266,6 @@ void omap_iommu_debugfs_remove(struct omap_iommu *obj) · 7 unmodified lines
287void __init omap_iommu_debugfs_init(void)266void __init omap_iommu_debugfs_init(void)
288{267{
289 iommu_debug_root = debugfs_create_dir("omap_iommu", NULL);268 iommu_debug_root = debugfs_create_dir("omap_iommu", NULL);
290 if (!iommu_debug_root)
291 pr_err("can't create debugfs dir\n");
292}269}
293 270
294void __exit omap_iommu_debugfs_exit(void)271void __exit omap_iommu_debugfs_exit(void)