diff mbox series

[v2,bpf-next] tools/resolve_btfids: Fix warnings

Message ID 20210329164541.3240579-1-sdf@google.com
State Superseded
Headers show
Series [v2,bpf-next] tools/resolve_btfids: Fix warnings | expand

Commit Message

Stanislav Fomichev March 29, 2021, 4:45 p.m. UTC
* make eprintf static, used only in main.c
* initialize ret in eprintf
* remove unused *tmp
* remove unused 'int err = -1'

Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
 tools/bpf/resolve_btfids/main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Stanislav Fomichev March 29, 2021, 5:26 p.m. UTC | #1
On Mon, Mar 29, 2021 at 10:23 AM Song Liu <song@kernel.org> wrote:
>
> On Mon, Mar 29, 2021 at 9:46 AM Stanislav Fomichev <sdf@google.com> wrote:
> >
> > * make eprintf static, used only in main.c
> > * initialize ret in eprintf
> > * remove unused *tmp
> > * remove unused 'int err = -1'
> >
> > Signed-off-by: Stanislav Fomichev <sdf@google.com>
> > ---
> >  tools/bpf/resolve_btfids/main.c | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
> > index 80d966cfcaa1..be74406626b7 100644
> > --- a/tools/bpf/resolve_btfids/main.c
> > +++ b/tools/bpf/resolve_btfids/main.c
> > @@ -115,10 +115,10 @@ struct object {
> >
> >  static int verbose;
> >
> > -int eprintf(int level, int var, const char *fmt, ...)
> > +static int eprintf(int level, int var, const char *fmt, ...)
> >  {
> >         va_list args;
> > -       int ret;
> > +       int ret = 0;
> >
> >         if (var >= level) {
> >                 va_start(args, fmt);
> > @@ -403,10 +403,9 @@ static int symbols_collect(struct object *obj)
> >          * __BTF_ID__* over .BTF_ids section.
> >          */
> >         for (i = 0; !err && i < n; i++) {
>                     ^^^^ This err is also not used.
Yeah, good point, let's remove that one as well. Thanks!

> > -               char *tmp, *prefix;
> > +               char *prefix;
> >                 struct btf_id *id;
> >                 GElf_Sym sym;
> > -               int err = -1;
> >
> >                 if (!gelf_getsym(obj->efile.symbols, i, &sym))
> >                         return -1;
> > --
> > 2.31.0.291.g576ba9dcdaf-goog
> >
diff mbox series

Patch

diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
index 80d966cfcaa1..be74406626b7 100644
--- a/tools/bpf/resolve_btfids/main.c
+++ b/tools/bpf/resolve_btfids/main.c
@@ -115,10 +115,10 @@  struct object {
 
 static int verbose;
 
-int eprintf(int level, int var, const char *fmt, ...)
+static int eprintf(int level, int var, const char *fmt, ...)
 {
 	va_list args;
-	int ret;
+	int ret = 0;
 
 	if (var >= level) {
 		va_start(args, fmt);
@@ -403,10 +403,9 @@  static int symbols_collect(struct object *obj)
 	 * __BTF_ID__* over .BTF_ids section.
 	 */
 	for (i = 0; !err && i < n; i++) {
-		char *tmp, *prefix;
+		char *prefix;
 		struct btf_id *id;
 		GElf_Sym sym;
-		int err = -1;
 
 		if (!gelf_getsym(obj->efile.symbols, i, &sym))
 			return -1;