Re: [PATCH] ipc: Remove uses of return value of seq_printf/seq_puts
From: Joe Perches
Date: Tue Feb 17 2015 - 19:55:31 EST
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/