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
239239 DEFINE_SHOW_ATTRIBUTE(tlb);
240240 DEFINE_SHOW_ATTRIBUTE(pagetable);
241241
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−
253242 void omap_iommu_debugfs_add(struct omap_iommu *obj)
254243 {
255244 struct dentry *d;
@@ -257,23 +246,13 @@ void omap_iommu_debugfs_add(struct omap_iommu *obj) · 1 unmodified line
257246 if (!iommu_debug_root)
258247 return;
259248
260− obj->debug_dir = debugfs_create_dir(obj->name, iommu_debug_root);
261− if (!obj->debug_dir)
262− return;
249+ d = debugfs_create_dir(obj->name, iommu_debug_root);
250+ obj->debug_dir = d;
263251
264− d = debugfs_create_u32("nr_tlb_entries", 0400, obj->debug_dir,
265− &obj->nr_tlb_entries);
266− if (!d)
267− return;
268−
269− DEBUG_ADD_FILE_RO(regs);
270− DEBUG_ADD_FILE_RO(tlb);
271− DEBUG_ADD_FILE_RO(pagetable);
272−
273− return;
274−
275−err:
276− debugfs_remove_recursive(obj->debug_dir);
252+ debugfs_create_u32("nr_tlb_entries", 0400, d, &obj->nr_tlb_entries);
253+ debugfs_create_file("regs", 0400, d, obj, &regs_fops);
254+ debugfs_create_file("tlb", 0400, d, obj, &tlb_fops);
255+ debugfs_create_file("pagetable", 0400, d, obj, &pagetable_fops);
277256 }
278257
279258 void omap_iommu_debugfs_remove(struct omap_iommu *obj)
@@ -287,8 +266,6 @@ void omap_iommu_debugfs_remove(struct omap_iommu *obj) · 7 unmodified lines
287266 void __init omap_iommu_debugfs_init(void)
288267 {
289268 iommu_debug_root = debugfs_create_dir("omap_iommu", NULL);
290− if (!iommu_debug_root)
291− pr_err("can't create debugfs dir\n");
292269 }
293270
294271 void __exit omap_iommu_debugfs_exit(void)