Re: [PATCH] Removed unnecessary initialization of "ret"
From: Steven Rostedt
Date: Mon Oct 28 2024 - 01:15:04 EST
On Sun, 27 Oct 2024 21:24:55 -0600
Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx> wrote:
> > diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
> > index 69e226a48daa..b13ab2ad0e88 100644
> > --- a/kernel/trace/fgraph.c
> > +++ b/kernel/trace/fgraph.c
> > @@ -1249,7 +1249,7 @@ int register_ftrace_graph(struct fgraph_ops *gops)
> > {
> > static bool fgraph_initialized;
> > int command = 0;
> > - int ret = 0;
> > + int ret;
> > int i = -1;
> >
> > guard(mutex)(&ftrace_lock);
>
> It makes sense to initialize ret - i think you might see a warning about
> ret being not initialized before use. I don't see much value in saving
> unnecessary computation.
FYI, I'm rewriting this code for the next merge window, so this patch
doesn't need to be applied (as it's not something Linus would take in
an -rc release cycle).
-- Steve