[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20091118171538.GK3273@beardog.cce.hp.com>
Date: Wed, 18 Nov 2009 11:15:38 -0600
From: scameron@...rdog.cce.hp.com
To: Dan Merillat <dan.merillat@...il.com>
Cc: Ingo Molnar <mingo@...e.hu>, Andy Whitcroft <apw@...onical.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Roel Kluin <roel.kluin@...il.com>,
LKML <linux-kernel@...r.kernel.org>, rostedt@...dmis.org,
Mike Miller <mike.miller@...com>,
Jens Axboe <jens.axboe@...cle.com>, iss_storagedev@...com
Subject: Re: [PATCH] ftrace: return error instead of 12 bytes read
On Wed, Nov 18, 2009 at 05:18:53AM -0500, Dan Merillat wrote:
> On Thu, Nov 12, 2009 at 8:45 AM, Ingo Molnar <mingo@...e.hu> wrote:
>
> > 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
>
> Except....
> fs/9p/fid.c: return ERR_PTR(-EPERM);
>
> try this:
>
> $ git grep "return E[A-Z]*;" | grep -v EOF | grep -v ERROR | wc -l
> 138
> $ git grep "return -E[A-Z]*;"| wc -l
> 57285
>
> 2 of those are in Documentation/ and 2 are comments from a quick
> glance. 134 uses of positive error returns, _74_ of which are in
> fs/xfs, 24 in bluetooth, and the rest scattered randomly around the
> kernel.
>
> 134 positive error returns vs 57881 negative? The style is so
> strongly ingrained in the kernel (And I'd bet an audit of those
> remaning 134 would find at least one bug) that it'd be a good janitor
> task to go through and switch them.
>
>
> This is one example - a function that returns either ENXIO or 0, and
> the lone caller explicitly tests and flips the sign.
>
> (Not signing off on this!!!! but CCing the relevant people for this driver)
>
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index 6399e50..79867d6 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -428,7 +428,7 @@ cciss_proc_write(struct file *file, const char __user *buf,
>
> rc = cciss_engage_scsi(h->ctlr);
> if (rc != 0)
> - err = -rc;
> + err = rc;
> else
> err = length;
> } else
> diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
> index 3315268..4af3085 100644
> --- a/drivers/block/cciss_scsi.c
> +++ b/drivers/block/cciss_scsi.c
> @@ -1547,7 +1547,7 @@ cciss_engage_scsi(int ctlr)
> if (sa->registered) {
> printk("cciss%d: SCSI subsystem already engaged.\n", ctlr);
> spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
> - return ENXIO;
> + return -ENXIO;
> }
> sa->registered = 1;
> spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
I sent a patch to fix this already.
http://groups.google.com/group/linux.kernel/browse_thread/thread/40b43d35dff0f30a/0a073fc8014547e0?hl=en&lnk=gst&q=cciss+weird#0a073fc8014547e0
-- steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists