linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] perf intel-pt: cleanup unneeded return variable in intel_pt_text_poke()
@ 2024-11-21 11:14 guanjing
  2024-11-26 13:09 ` Adrian Hunter
  0 siblings, 1 reply; 2+ messages in thread
From: guanjing @ 2024-11-21 11:14 UTC (permalink / raw)
  To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
	jolsa, irogers, adrian.hunter, kan.liang, algonell
  Cc: linux-perf-users, linux-kernel, guanjing

Removed Unneeded variable: "ret".

Since the function intel_pt_text_poke() always returns zero,
drop the return value and change the function to the void type.

Signed-off-by: guanjing <guanjing@cmss.chinamobile.com>
---
 tools/perf/util/intel-pt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 30be6dfe09eb..a13add0e0be4 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -3391,7 +3391,7 @@ static int intel_pt_find_map(struct thread *thread, u8 cpumode, u64 addr,
 }
 
 /* Invalidate all instruction cache entries that overlap the text poke */
-static int intel_pt_text_poke(struct intel_pt *pt, union perf_event *event)
+static void intel_pt_text_poke(struct intel_pt *pt, union perf_event *event)
 {
 	u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
 	u64 addr = event->text_poke.addr + event->text_poke.new_len - 1;
@@ -3402,7 +3402,6 @@ static int intel_pt_text_poke(struct intel_pt *pt, union perf_event *event)
 	struct machine *machine = pt->machine;
 	struct intel_pt_cache_entry *e;
 	u64 offset;
-	int ret = 0;
 
 	addr_location__init(&al);
 	if (!event->text_poke.new_len)
@@ -3443,7 +3442,6 @@ static int intel_pt_text_poke(struct intel_pt *pt, union perf_event *event)
 	}
 out:
 	addr_location__exit(&al);
-	return ret;
 }
 
 static int intel_pt_process_event(struct perf_session *session,
@@ -3522,7 +3520,7 @@ static int intel_pt_process_event(struct perf_session *session,
 		err = intel_pt_context_switch(pt, event, sample);
 
 	if (!err && event->header.type == PERF_RECORD_TEXT_POKE)
-		err = intel_pt_text_poke(pt, event);
+		intel_pt_text_poke(pt, event);
 
 	if (intel_pt_enable_logging && intel_pt_log_events(pt, sample->time)) {
 		intel_pt_log("event %u: cpu %d time %"PRIu64" tsc %#"PRIx64" ",
-- 
2.33.0




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] perf intel-pt: cleanup unneeded return variable in intel_pt_text_poke()
  2024-11-21 11:14 [PATCH v2] perf intel-pt: cleanup unneeded return variable in intel_pt_text_poke() guanjing
@ 2024-11-26 13:09 ` Adrian Hunter
  0 siblings, 0 replies; 2+ messages in thread
From: Adrian Hunter @ 2024-11-26 13:09 UTC (permalink / raw)
  To: guanjing, peterz, mingo, acme, namhyung, mark.rutland,
	alexander.shishkin, jolsa, irogers, kan.liang, algonell
  Cc: linux-perf-users, linux-kernel

On 21/11/24 13:14, guanjing wrote:
> Removed Unneeded variable: "ret".
> 
> Since the function intel_pt_text_poke() always returns zero,
> drop the return value and change the function to the void type.
> 
> Signed-off-by: guanjing <guanjing@cmss.chinamobile.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  tools/perf/util/intel-pt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
> index 30be6dfe09eb..a13add0e0be4 100644
> --- a/tools/perf/util/intel-pt.c
> +++ b/tools/perf/util/intel-pt.c
> @@ -3391,7 +3391,7 @@ static int intel_pt_find_map(struct thread *thread, u8 cpumode, u64 addr,
>  }
>  
>  /* Invalidate all instruction cache entries that overlap the text poke */
> -static int intel_pt_text_poke(struct intel_pt *pt, union perf_event *event)
> +static void intel_pt_text_poke(struct intel_pt *pt, union perf_event *event)
>  {
>  	u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
>  	u64 addr = event->text_poke.addr + event->text_poke.new_len - 1;
> @@ -3402,7 +3402,6 @@ static int intel_pt_text_poke(struct intel_pt *pt, union perf_event *event)
>  	struct machine *machine = pt->machine;
>  	struct intel_pt_cache_entry *e;
>  	u64 offset;
> -	int ret = 0;
>  
>  	addr_location__init(&al);
>  	if (!event->text_poke.new_len)
> @@ -3443,7 +3442,6 @@ static int intel_pt_text_poke(struct intel_pt *pt, union perf_event *event)
>  	}
>  out:
>  	addr_location__exit(&al);
> -	return ret;
>  }
>  
>  static int intel_pt_process_event(struct perf_session *session,
> @@ -3522,7 +3520,7 @@ static int intel_pt_process_event(struct perf_session *session,
>  		err = intel_pt_context_switch(pt, event, sample);
>  
>  	if (!err && event->header.type == PERF_RECORD_TEXT_POKE)
> -		err = intel_pt_text_poke(pt, event);
> +		intel_pt_text_poke(pt, event);
>  
>  	if (intel_pt_enable_logging && intel_pt_log_events(pt, sample->time)) {
>  		intel_pt_log("event %u: cpu %d time %"PRIu64" tsc %#"PRIx64" ",


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-26 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-21 11:14 [PATCH v2] perf intel-pt: cleanup unneeded return variable in intel_pt_text_poke() guanjing
2024-11-26 13:09 ` Adrian Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).