| Date | Tue, 28 Nov 2023 14:18:29 -0800 | Subject | Re: [PATCH v2 20/26] selftests/resctrl: Create struct for input parameters | From | Reinette Chatre <> |
| |
Hi Ilpo,
On 11/20/2023 3:13 AM, Ilpo Järvinen wrote:
...
> > +static void init_user_params(struct user_params *uparams) > +{ > + uparams->cpu = 1; > + uparams->bits = 0; > +} > + > int main(int argc, char **argv) > { > bool mbm_test = true, mba_test = true, cmt_test = true; > - const char *benchmark_cmd[BENCHMARK_ARGS] = {}; > - int c, cpu_no = 1, i, no_of_bits = 0; > + struct user_params uparams = {}; > char *span_str = NULL; > bool cat_test = true; > int tests = 0; > - int ret; > + int ret, c, i; > + > + init_user_params(&uparams); >
It is unexpected that this uses a combination of designated initializer (via {}) as well as an explicit init function to initialize the struct. I think it would be simpler to do all initialization in the init function.
Reinette
|