Skip to content

Commit

Permalink
selftests/resctrl: Change initialize_llc_perf() return type to void
Browse files Browse the repository at this point in the history
initialize_llc_perf() unconditionally returns 0.

initialize_llc_perf() performs only memory initialization, none of
which can fail.

Change the return type from int to void to accurately reflect that its
return value doesn't need to be checked. Remove the error checking from
the only callsite.

Co-developed-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
Ilpo Järvinen authored and Shuah Khan committed Apr 10, 2023
1 parent 5d869d7 commit 9ce29d2
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tools/testing/selftests/resctrl/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static int perf_event_open_llc_miss(pid_t pid, int cpu_no)
return 0;
}

static int initialize_llc_perf(void)
static void initialize_llc_perf(void)
{
memset(&pea_llc_miss, 0, sizeof(struct perf_event_attr));
memset(&rf_cqm, 0, sizeof(struct read_format));
Expand All @@ -59,8 +59,6 @@ static int initialize_llc_perf(void)
pea_llc_miss.config = PERF_COUNT_HW_CACHE_MISSES;

rf_cqm.nr = 1;

return 0;
}

static int reset_enable_llc_perf(pid_t pid, int cpu_no)
Expand Down Expand Up @@ -234,11 +232,8 @@ int cat_val(struct resctrl_val_param *param)
if (ret)
return ret;

if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR))) {
ret = initialize_llc_perf();
if (ret)
return ret;
}
if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)))
initialize_llc_perf();

/* Test runs until the callback setup() tells the test to stop. */
while (1) {
Expand Down

0 comments on commit 9ce29d2

Please sign in to comment.