perf evsel: Remove duplicate check for `field` in evsel__intval()

Message ID 20230815221009.3641751-1-yangjihong1@huawei.com
State New
Headers
Series perf evsel: Remove duplicate check for `field` in evsel__intval() |

Commit Message

Yang Jihong Aug. 15, 2023, 10:10 p.m. UTC
  The `file` parameter in evsel__intval() is checked repeatedly, fix it.

No functional change.

Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
 tools/perf/util/evsel.c | 3 ---
 1 file changed, 3 deletions(-)
  

Comments

Arnaldo Carvalho de Melo Aug. 15, 2023, 5:43 p.m. UTC | #1
Em Tue, Aug 15, 2023 at 10:10:09PM +0000, Yang Jihong escreveu:
> The `file` parameter in evsel__intval() is checked repeatedly, fix it.
> 
> No functional change.

Thanks, applied.

- Arnaldo

 
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
> ---
>  tools/perf/util/evsel.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index e41bc4d9925f..0c50c443d456 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -2827,9 +2827,6 @@ u64 evsel__intval(struct evsel *evsel, struct perf_sample *sample, const char *n
>  {
>  	struct tep_format_field *field = evsel__field(evsel, name);
>  
> -	if (!field)
> -		return 0;
> -
>  	return field ? format_field__intval(field, sample, evsel->needs_swap) : 0;
>  }
>  #endif
> -- 
> 2.39.2
>
  

Patch

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index e41bc4d9925f..0c50c443d456 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2827,9 +2827,6 @@  u64 evsel__intval(struct evsel *evsel, struct perf_sample *sample, const char *n
 {
 	struct tep_format_field *field = evsel__field(evsel, name);
 
-	if (!field)
-		return 0;
-
 	return field ? format_field__intval(field, sample, evsel->needs_swap) : 0;
 }
 #endif