From: Ingo Molnar <mingo@elte.hu>
To: Andy Whitcroft <apw@canonical.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Roel Kluin <roel.kluin@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
rostedt@goodmis.org
Subject: Re: [PATCH] ftrace: return error instead of 12 bytes read
Date: Thu, 12 Nov 2009 14:45:54 +0100 [thread overview]
Message-ID: <20091112134554.GA30272@elte.hu> (raw)
In-Reply-To: <25d66d860911120531u6a9cd40dmf3056fd99bd97f4e@mail.gmail.com>
* Andy Whitcroft <apw@canonical.com> wrote:
> >> ? ? ? s = kmalloc(sizeof(*s), GFP_KERNEL);
> >> ? ? ? if (!s)
> >> - ? ? ? ? ? ? return ENOMEM;
> >> + ? ? ? ? ? ? return -ENOMEM;
> >>
> >> ? ? ? trace_seq_init(s);
> >>
> >
> > lol, there we go again.
> >
> > Andy, can we have a checkpatch rule please?
>
> Thats a tricky one. Not only do we not really have a sensible way to
> know if ENOMEM is an errno, we also find a bunch of places that we
> appear to use positive errno's as return values where we would falsly
> complain about. Its particularly common in scsi and filesystems.
> Admittedly the vast majority are return -EXXX form, so we could add
> this as a non-default check perhaps.
>
> Thoughts?
Even in filesystems, ~80% of the cases use proper negative values:
$ git grep 'return -E' fs/ | wc -l
4540
$ git grep 'return E' fs/ | wc -l
895
For SCSI it's even better, ~97% of the cases use the kernel's standard:
$ git grep 'return -E' drivers/scsi/ | wc -l
1448
$ git grep 'return E' drivers/scsi/ | wc -l
50
So i'd suggest to make this a default-enabled check. (default disabled
checks are used only by a small minority) For a _long_ time has this
been the kernel standard.
Ingo
next prev parent reply other threads:[~2009-11-12 13:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-11 21:26 [PATCH] ftrace: return error instead of 12 bytes read Roel Kluin
2009-11-11 21:47 ` Andrew Morton
2009-11-11 21:58 ` Steven Rostedt
[not found] ` <20091112081043.GA25345@elte.hu>
2009-11-12 9:47 ` [patch] Fix: 'return -ENOMEM' instead of 'return ENOMEM' Alexey Dobriyan
2009-11-12 13:31 ` [PATCH] ftrace: return error instead of 12 bytes read Andy Whitcroft
2009-11-12 13:45 ` Ingo Molnar [this message]
2009-11-12 14:10 ` Andy Whitcroft
2009-11-18 10:18 ` Dan Merillat
2009-11-18 17:15 ` scameron
2009-11-11 21:57 ` Steven Rostedt
2009-11-12 2:33 ` [PATCH][GIT PULL][v2.6.32] tracing: Fix return value of tracing_stats_read() Steven Rostedt
2009-11-12 7:50 ` Ingo Molnar
2009-11-12 8:21 ` [tip:tracing/urgent] " tip-bot for Roel Kluin
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=20091112134554.GA30272@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roel.kluin@gmail.com \
--cc=rostedt@goodmis.org \
/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