Skip to content

Commit 026bb84

Browse files
chengkaitaorostedt
authored andcommitted
ftrace: Fix maybe-uninitialized compiler warning
During build compiler reports some 'false positive' warnings about variables {'seq_ops', 'filtered_pids', 'other_pids'} may be used uninitialized. This patch silences these warnings. Also delete some useless spaces Link: https://lkml.kernel.org/r/20200529141214.37648-1-pilgrimtao@gmail.com Signed-off-by: Kaitao Cheng <pilgrimtao@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 5414251 commit 026bb84

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎kernel/trace/ftrace.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,7 +2260,7 @@ ftrace_find_tramp_ops_next(struct dyn_ftrace *rec,
22602260

22612261
if (hash_contains_ip(ip, op->func_hash))
22622262
return op;
2263-
}
2263+
}
22642264

22652265
return NULL;
22662266
}
@@ -3599,7 +3599,7 @@ static int t_show(struct seq_file *m, void *v)
35993599
if (direct)
36003600
seq_printf(m, "\n\tdirect-->%pS", (void *)direct);
36013601
}
3602-
}
3602+
}
36033603

36043604
seq_putc(m, '\n');
36053605

@@ -7151,6 +7151,10 @@ static int pid_open(struct inode *inode, struct file *file, int type)
71517151
case TRACE_NO_PIDS:
71527152
seq_ops = &ftrace_no_pid_sops;
71537153
break;
7154+
default:
7155+
trace_array_put(tr);
7156+
WARN_ON_ONCE(1);
7157+
return -EINVAL;
71547158
}
71557159

71567160
ret = seq_open(file, seq_ops);
@@ -7229,6 +7233,10 @@ pid_write(struct file *filp, const char __user *ubuf,
72297233
other_pids = rcu_dereference_protected(tr->function_pids,
72307234
lockdep_is_held(&ftrace_lock));
72317235
break;
7236+
default:
7237+
ret = -EINVAL;
7238+
WARN_ON_ONCE(1);
7239+
goto out;
72327240
}
72337241

72347242
ret = trace_pid_write(filtered_pids, &pid_list, ubuf, cnt);

0 commit comments

Comments
 (0)