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 <j...@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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to