Re: [PATCH] Minor coding style fix

From: Jesper Juhl
Date: Sun Oct 08 2006 - 11:29:24 EST


On 08/10/06, Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxx> wrote:
Kernel generally follow the style

if (func()) {
/* failed case */
} else {
/* success */
}



Please submit patches inline, having to copy them from attachments to
be able to reply is a pain.


diff --git a/kernel/sys.c b/kernel/sys.c
index 98489d8..55cb77c 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -517,7 +517,7 @@ EXPORT_SYMBOL_GPL(srcu_notifier_call_cha
void srcu_init_notifier_head(struct srcu_notifier_head *nh)
{
mutex_init(&nh->mutex);
- if (init_srcu_struct(&nh->srcu) < 0)
+ if (init_srcu_struct(&nh->srcu))
BUG();
nh->head = NULL;
}

I really liked the old code better. If in the future
init_srcu_struct() is changed to also return >0 for some conditions,
then that would not previously have triggered BUG(), but after your
changes it will. The code, as it were, perfectly expressed what it
wanted to happen - if it returns less than zero it's a BUG().
I say leave it alone.


--
Jesper Juhl <jesper.juhl@xxxxxxxxx>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
-
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/