summaryrefslogtreecommitdiffstats
path: root/lib/string_helpers.c
diff options
context:
space:
mode:
authorRasmus Villemoes <linux@rasmusvillemoes.dk>2015-02-12 15:01:50 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-12 18:54:13 -0800
commitd1214c65c02d503330ce86bd38e344a36599e055 (patch)
treee07829fc569c35be5860b239ad3e9c4e2b28e6cb /lib/string_helpers.c
parent84b9fbedf54a6ea4fba62ef8a167138233586ad3 (diff)
downloadop-kernel-dev-d1214c65c02d503330ce86bd38e344a36599e055.zip
op-kernel-dev-d1214c65c02d503330ce86bd38e344a36599e055.tar.gz
libstring_helpers.c:string_get_size(): return void
string_get_size() was documented to return an error, but in fact always returned 0. Since the output always fits in 9 bytes, just document that and let callers do what they do now: pass a small stack buffer and ignore the return value. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/string_helpers.c')
-rw-r--r--lib/string_helpers.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/string_helpers.c b/lib/string_helpers.c
index 2b3757f..8f8c441 100644
--- a/lib/string_helpers.c
+++ b/lib/string_helpers.c
@@ -20,12 +20,12 @@
* @len: length of buffer
*
* This function returns a string formatted to 3 significant figures
- * giving the size in the required units. Returns 0 on success or
- * error on failure. @buf is always zero terminated.
+ * giving the size in the required units. @buf should have room for
+ * at least 9 bytes and will always be zero terminated.
*
*/
-int string_get_size(u64 size, const enum string_size_units units,
- char *buf, int len)
+void string_get_size(u64 size, const enum string_size_units units,
+ char *buf, int len)
{
static const char *const units_10[] = {
"B", "kB", "MB", "GB", "TB", "PB", "EB"
@@ -67,8 +67,6 @@ int string_get_size(u64 size, const enum string_size_units units,
snprintf(buf, len, "%u%s %s", (u32)size,
tmp, units_str[units][i]);
-
- return 0;
}
EXPORT_SYMBOL(string_get_size);
OpenPOWER on IntegriCloud