Fix list output whitespace

This commit is contained in:
Christoffer Sandberg 2022-11-18 18:36:40 +01:00
parent acc12d579f
commit dcf9ec030c

View file

@ -857,11 +857,17 @@ static ssize_t uw_charging_prios_available_show(struct device *child,
struct device_attribute *attr,
char *buffer)
{
int i;
for (i = 0; i < ARRAY_SIZE(charging_prio_options); ++i)
int i, n;
n = ARRAY_SIZE(charging_prio_options);
for (i = 0; i < n; ++i) {
sprintf(buffer + strlen(buffer), "%s",
charging_prio_options[i].descriptor);
if (i < n - 1)
sprintf(buffer + strlen(buffer), " ");
else
sprintf(buffer + strlen(buffer), "\n");
}
return strlen(buffer);
}