lkml.org 
[lkml]   [2013]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH -next 4/4] debugfs: Fix misuse of seq_printf return value
Date
Adding repeated -1 to the return is not correct.

Use seq_is_buf_full to test for unnecessary seq_printf uses
and always return 0.

Signed-off-by: Joe Perches <joe@perches.com>
---
fs/debugfs/file.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 6314629..da65fed 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -695,15 +695,17 @@ EXPORT_SYMBOL_GPL(debugfs_create_u32_array);
int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
int nregs, void __iomem *base, char *prefix)
{
- int i, ret = 0;
+ int i;

for (i = 0; i < nregs; i++, regs++) {
- if (prefix)
- ret += seq_printf(s, "%s", prefix);
- ret += seq_printf(s, "%s = 0x%08x\n", regs->name,
- readl(base + regs->offset));
+ seq_printf(s, "%s%s = 0x%08x\n",
+ prefix ? prefix : "",
+ regs->name, readl(base + regs->offset));
+ if (seq_is_buf_full(s))
+ break;
}
- return ret;
+
+ return 0;
}
EXPORT_SYMBOL_GPL(debugfs_print_regs32);

--
1.8.1.2.459.gbcd45b4.dirty


\
 
 \ /
  Last update: 2013-12-13 01:41    [W:0.080 / U:0.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site