diff options
author | Jim Cromie <jim.cromie@gmail.com> | 2020-07-19 17:10:49 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-07-24 17:00:09 +0200 |
commit | 9c9d0acbe2793315fa6945a19685ad2a51fb281b (patch) | |
tree | 111d57017f676b713e97ea80f09981994fa7443d /lib/dynamic_debug.c | |
parent | 0b8f96be9bd41521b6379b403cfce78934f8274c (diff) | |
download | lwn-9c9d0acbe2793315fa6945a19685ad2a51fb281b.tar.gz lwn-9c9d0acbe2793315fa6945a19685ad2a51fb281b.zip |
dyndbg: prefer declarative init in caller, to memset in callee
ddebug_exec_query declares an auto var, and passes it to
ddebug_parse_query, which memsets it before using it. Drop that
memset, instead initialize the variable in the caller; let the
compiler decide how to do it.
Acked-by: <jbaron@akamai.com>
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Link: https://lore.kernel.org/r/20200719231058.1586423-10-jim.cromie@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib/dynamic_debug.c')
-rw-r--r-- | lib/dynamic_debug.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 1d25a846553b..da3ed54a6521 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -330,7 +330,6 @@ static int ddebug_parse_query(char *words[], int nwords, pr_err("expecting pairs of match-spec <value>\n"); return -EINVAL; } - memset(query, 0, sizeof(*query)); if (modname) /* support $modname.dyndbg=<multiple queries> */ @@ -448,7 +447,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp, static int ddebug_exec_query(char *query_string, const char *modname) { unsigned int flags = 0, mask = 0; - struct ddebug_query query; + struct ddebug_query query = {}; #define MAXWORDS 9 int nwords, nfound; char *words[MAXWORDS]; |