'modalias' is only written with snprintf() and it is already guaranteed
to be nul-terminated, so remove the unneeded (but harmless) writes of a
trailing '\0' to it.
Also snprintf() never returns negative values, so remove redundant (but
harmless) checks for it.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
[ rjw: Merge two patches into one, combine changelogs, add subject ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
continue;
count = snprintf(&modalias[len], size, "%s:", id->id);
- if (count < 0)
- return -EINVAL;
if (count >= size)
return -ENOMEM;
len += count;
size -= count;
}
- modalias[len] = '\0';
+
return len;
}
for (i = 0; i < nval; i++, obj++) {
count = snprintf(&modalias[len], size, "C%s",
obj->string.pointer);
- if (count < 0)
- return -EINVAL;
if (count >= size)
return -ENOMEM;
len += count;
size -= count;
}
- modalias[len] = '\0';
+
return len;
}