Skip to contentSkip to conversation

perf symbols: Remove unused variable 'err'

PATCH Applied Leo Yan 3 participants 4 messages May 30, 2019 – Jun 17, 2019 perf events

lore
Share & tools
lore

Leo Yan

author
#0 lore raw

PATCH 1/1 perf symbols: Remove unused variable 'err'

Variable 'err' is defined but never used in function symsrc__init(), remove it and directly return -1 at the end of the function.

---
 tools/perf/util/symbol-elf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/symbol-elf.c +1 -2
index 4ad106a5f2c0..fdc5bd7dbb90 100644
@@ -699,7 +699,6 @@ bool __weak elf__needs_adjust_symbols(GElf_Ehdr ehdr)
 int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
 		 enum dso_binary_type type)
 {
-	int err = -1;
 	GElf_Ehdr ehdr;
 	Elf *elf;
 	int fd;
@@ -793,7 +792,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
 	elf_end(elf);
 out_close:
 	close(fd);
-	return err;
+	return -1;
 }
 
 /**
Signature · 1 line
2.17.1
#1 lore raw

Em Thu, May 30, 2019 at 05:38:01PM +0800, Leo Yan escreveu:

Quoted 2 lines

Variable 'err' is defined but never used in function symsrc__init(), remove it and directly return -1 at the end of the function.

Thanks, applied.

- Arnaldo

Quoted 28 lines
---
 tools/perf/util/symbol-elf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/symbol-elf.c +1 -2
index 4ad106a5f2c0..fdc5bd7dbb90 100644
@@ -699,7 +699,6 @@ bool __weak elf__needs_adjust_symbols(GElf_Ehdr ehdr)
 int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
 		 enum dso_binary_type type)
 {
-	int err = -1;
 	GElf_Ehdr ehdr;
 	Elf *elf;
 	int fd;
@@ -793,7 +792,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
 	elf_end(elf);
 out_close:
 	close(fd);
-	return err;
+	return -1;
 }
 
 /**
Signature · 1 line
2.17.1
Signature · 1 line
- Arnaldo
author
#2 lore raw
Quoted 5 lines · Arnaldo Carvalho de Melo

Em Thu, May 30, 2019 at 05:38:01PM +0800, Leo Yan escreveu:

Quoted 2 lines

Variable 'err' is defined but never used in function symsrc__init(), remove it and directly return -1 at the end of the function.

Thanks, applied.

Thanks, Arnaldo.

#3 lore raw
In reply to Leo Yan
perf symbols: Remove unused variable 'err'
Commit-ID:  e5f177a578edf4501d0758bfa922cd0b0f9d0e9d
Gitweb:     https://git.kernel.org/tip/e5f177a578edf4501d0758bfa922cd0b0f9d0e9d
Author:     Leo Yan <[email protected]>
AuthorDate: Thu, 30 May 2019 17:38:01 +0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 5 Jun 2019 09:47:54 -0300

perf symbols: Remove unused variable 'err'

Variable 'err' is defined but never used in function symsrc__init(), remove it and directly return -1 at the end of the function.

---
 tools/perf/util/symbol-elf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/symbol-elf.c +1 -2
index 4ad106a5f2c0..fdc5bd7dbb90 100644
@@ -699,7 +699,6 @@ bool __weak elf__needs_adjust_symbols(GElf_Ehdr ehdr)
 int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
 		 enum dso_binary_type type)
 {
-	int err = -1;
 	GElf_Ehdr ehdr;
 	Elf *elf;
 	int fd;
@@ -793,7 +792,7 @@ out_elf_end:
 	elf_end(elf);
 out_close:
 	close(fd);
-	return err;
+	return -1;
 }
 
 /**