summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2017-03-29 11:38:13 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-03-31 18:00:35 -0400
commitc1bc5919f6741cc4b0c83e3058b3d65d76c943e3 (patch)
tree39c2658a31e40193ecb4893558631d467edd49fe /kernel
parent2b87965a1e6b6051435315d3f04627a5dbad979c (diff)
downloadlinux-stable-c1bc5919f6741cc4b0c83e3058b3d65d76c943e3.tar.gz
linux-stable-c1bc5919f6741cc4b0c83e3058b3d65d76c943e3.tar.bz2
linux-stable-c1bc5919f6741cc4b0c83e3058b3d65d76c943e3.zip
ftrace: Clean up __seq_open_private() return check
The return status check of __seq_open_private() is rather strange: iter = __seq_open_private(); if (iter) { /* do stuff */ } return iter ? 0 : -ENOMEM; It makes much more sense to do the return of failure right away: iter = __seq_open_private(); if (!iter) return -ENOMEM; /* do stuff */ return 0; This clean up will make updates to this code a bit nicer. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/ftrace.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 0556a202c055..527c4d3e8d7f 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3355,12 +3355,13 @@ ftrace_avail_open(struct inode *inode, struct file *file)
return -ENODEV;
iter = __seq_open_private(file, &show_ftrace_seq_ops, sizeof(*iter));
- if (iter) {
- iter->pg = ftrace_pages_start;
- iter->ops = &global_ops;
- }
+ if (!iter)
+ return -ENOMEM;
- return iter ? 0 : -ENOMEM;
+ iter->pg = ftrace_pages_start;
+ iter->ops = &global_ops;
+
+ return 0;
}
static int
@@ -3369,13 +3370,14 @@ ftrace_enabled_open(struct inode *inode, struct file *file)
struct ftrace_iterator *iter;
iter = __seq_open_private(file, &show_ftrace_seq_ops, sizeof(*iter));
- if (iter) {
- iter->pg = ftrace_pages_start;
- iter->flags = FTRACE_ITER_ENABLED;
- iter->ops = &global_ops;
- }
+ if (!iter)
+ return -ENOMEM;
- return iter ? 0 : -ENOMEM;
+ iter->pg = ftrace_pages_start;
+ iter->flags = FTRACE_ITER_ENABLED;
+ iter->ops = &global_ops;
+
+ return 0;
}
/**