This patch fixes parsing value of core variable in pipeline config.
Before not every combination of cores (c), sockets (s) and
hyperthreading (h) was parsed correctly.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
switch (type) {
case 's':
case 'S':
- if (s_parsed)
+ if (s_parsed || c_parsed || h_parsed)
return -EINVAL;
s_parsed = 1;
next++;
break;
case 'c':
case 'C':
- if (c_parsed)
+ if (c_parsed || h_parsed)
return -EINVAL;
c_parsed = 1;
next++;
num[num_len] = *next;
}
- if (num_len == 0 && type != 'h')
+ if (num_len == 0 && type != 'h' && type != 'H')
+ return -EINVAL;
+
+ if (num_len != 0 && (type == 'h' || type == 'H'))
return -EINVAL;
num[num_len] = '\0';
case 'c':
case 'C':
c = val;
- if (type == 'C' && *next != '\0')
- return -EINVAL;
-
break;
case 'h':
case 'H':