Skip to content

Commit

Permalink
selftests/resctrl: Check for return value after write_schemata()
Browse files Browse the repository at this point in the history
MBA test case writes schemata but it does not check if the write is
successful or not.

Add the error check and return error properly.

Fixes: 01fee6b ("selftests/resctrl: Add MBA test")
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 fa10366 commit 0d45c83
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/testing/selftests/resctrl/mba_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ static int mba_setup(int num, ...)
struct resctrl_val_param *p;
char allocation_str[64];
va_list param;
int ret;

va_start(param, num);
p = va_arg(param, struct resctrl_val_param *);
Expand All @@ -45,7 +46,11 @@ static int mba_setup(int num, ...)

sprintf(allocation_str, "%d", allocation);

write_schemata(p->ctrlgrp, allocation_str, p->cpu_no, p->resctrl_val);
ret = write_schemata(p->ctrlgrp, allocation_str, p->cpu_no,
p->resctrl_val);
if (ret < 0)
return ret;

allocation -= ALLOCATION_STEP;

return 0;
Expand Down

0 comments on commit 0d45c83

Please sign in to comment.