public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ipc: Remove uses of return value of seq_printf/seq_puts
Date: Tue, 17 Feb 2015 16:55:10 -0800	[thread overview]
Message-ID: <1424220910.25416.13.camel@perches.com> (raw)
In-Reply-To: <20150218002751.GP29656@ZenIV.linux.org.uk>

On Wed, 2015-02-18 at 00:27 +0000, Al Viro wrote:
> On Tue, Feb 17, 2015 at 04:09:44PM -0800, Joe Perches wrote:
> > On Tue, 2015-02-17 at 23:16 +0000, Al Viro wrote:
> > > Most of the time checking return value of seq_...() is better replaced with
> > > not doing that.  And "must check return value and Do Something(tm)" is too
> > > strong habit for enough people to cause recurring trouble.
> > 
> > Does SEQ_SKIP still have value?
> 
> Yes, it does, but it's not an error - it's an equivalent of "empty the buffer
> before returning".  Basically, it's "I've decided that this entry shouldn't
> produce anything".  Look at the caller:

Yeah.

I should have looked at the traverse function first.

>                 error = m->op->show(m, p);
>                 if (error < 0)
>                         break;
>                 if (unlikely(error)) {
>                         error = 0;
>                         m->count = 0;
>                 }

Basically all the show functions that I converted
to use seq_has_overflowed() should just return 0.

There are only 3 current uses of SEQ_SKIP

drivers/infiniband/hw/qib/qib_debugfs.c:119:            return SEQ_SKIP;
drivers/infiniband/hw/qib/qib_debugfs.c:177:            return SEQ_SKIP;
drivers/infiniband/hw/qib/qib_debugfs.c:183:            return SEQ_SKIP;

As far as I can tell, these uses would be fine
not using SEQ_SKIP and just emitting 0 instead
of nothing.



      reply	other threads:[~2015-02-18  0:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-17 19:44 [PATCH] ipc: Remove uses of return value of seq_printf/seq_puts Joe Perches
2015-02-17 22:52 ` Andrew Morton
2015-02-17 23:02   ` Joe Perches
2015-02-17 23:16   ` Al Viro
2015-02-18  0:09     ` Joe Perches
2015-02-18  0:27       ` Al Viro
2015-02-18  0:55         ` Joe Perches [this message]

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=1424220910.25416.13.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.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