From: Steven Rostedt <rostedt@goodmis.org>
To: Joe Perches <joe@perches.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>, Petr Mladek <pmladek@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/7] debugfs: Fix misuse of seq_printf return value
Date: Tue, 28 Oct 2014 10:58:31 -0400 [thread overview]
Message-ID: <20141028105831.69a14d4d@gandalf.local.home> (raw)
In-Reply-To: <2634b19eb1c04a9d31148c1fe6f1f3819be95349.1412031505.git.joe@perches.com>
On Mon, 29 Sep 2014 16:08:26 -0700
Joe Perches <joe@perches.com> wrote:
> Adding repeated -1 to the return is not correct.
>
> Use seq_is_full to test for unnecessary seq_printf uses
> and always return 0.
Actually, debugfs_print_regs32() should return void as well.
I'll update that.
Thanks,
-- Steve
>
> 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 76c08c2..c24e578 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_full(s))
> + break;
> }
> - return ret;
> +
> + return 0;
> }
> EXPORT_SYMBOL_GPL(debugfs_print_regs32);
>
next prev parent reply other threads:[~2014-10-28 14:58 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-26 18:37 [PATCH] seq_file: Fix seq_putc() to be consistent with seq_puts() Steven Rostedt
2014-09-29 14:41 ` Petr Mladek
2014-09-29 15:25 ` Steven Rostedt
2014-09-29 15:46 ` Joe Perches
2014-09-29 16:11 ` Steven Rostedt
2014-09-29 16:23 ` Petr Mladek
2014-09-29 16:40 ` Steven Rostedt
2014-09-29 15:47 ` Al Viro
2014-09-29 16:08 ` Joe Perches
2014-09-29 16:15 ` Steven Rostedt
2014-09-29 16:30 ` Joe Perches
2014-09-29 16:42 ` Steven Rostedt
2014-09-29 16:55 ` Joe Perches
2014-09-29 23:08 ` [PATCH 0/7] seq_printf cleanups Joe Perches
2014-09-29 23:08 ` [PATCH 1/7] seq_file: Rename static bool seq_overflow to public bool seq_is_full Joe Perches
2014-09-29 23:44 ` Steven Rostedt
2014-09-29 23:48 ` Joe Perches
2014-09-30 10:06 ` Petr Mladek
2014-09-29 23:08 ` [PATCH 2/7] netfilter: Convert print_tuple functions to return void Joe Perches
2014-09-30 10:22 ` Petr Mladek
2014-09-30 13:04 ` Joe Perches
2014-09-29 23:08 ` [PATCH 3/7] dlm: Use seq_is_full - remove seq_printf returns Joe Perches
2014-09-30 10:34 ` Petr Mladek
2014-10-27 20:17 ` Steven Rostedt
2014-10-27 20:25 ` Joe Perches
2014-10-29 12:21 ` Petr Mladek
2014-09-29 23:08 ` [PATCH 4/7] dlm: Use seq_puts, remove unnecessary trailing spaces Joe Perches
2014-09-29 23:08 ` [PATCH 5/7] fs: Convert show_fdinfo functions to void Joe Perches
2014-10-28 14:11 ` Steven Rostedt
2014-10-28 14:31 ` Joe Perches
2014-10-28 14:43 ` Steven Rostedt
2014-09-29 23:08 ` [PATCH 6/7] debugfs: Fix misuse of seq_printf return value Joe Perches
2014-10-28 14:58 ` Steven Rostedt [this message]
2014-10-28 15:25 ` Joe Perches
2014-10-28 15:42 ` Steven Rostedt
2014-10-28 15:59 ` Joe Perches
2014-11-07 19:03 ` Greg Kroah-Hartman
2014-09-29 23:08 ` [PATCH 7/7] docg3: Fix miuse " Joe Perches
2014-10-22 8:29 ` Brian Norris
2014-10-28 15:13 ` Steven Rostedt
2014-10-28 15:57 ` Joe Perches
2014-10-28 16:05 ` Steven Rostedt
2014-10-28 17:14 ` Brian Norris
2014-10-28 17:26 ` Steven Rostedt
2014-10-28 17:27 ` Joe Perches
2014-10-28 17:32 ` Steven Rostedt
2014-10-28 17:36 ` Brian Norris
2014-10-28 17:38 ` Joe Perches
2014-10-28 15:32 ` [PATCH 0/7] seq_printf cleanups Steven Rostedt
2014-10-28 15:51 ` Joe Perches
2014-10-06 3:33 ` [PATCH] seq_file: Fix seq_putc() to be consistent with seq_puts() Joe Perches
2014-09-29 16:09 ` Steven Rostedt
2014-09-29 16:41 ` Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141028105831.69a14d4d@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.cz \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®