lkml.org 
[lkml]   [2006]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 02/16] ehca: module infrastructure
On Thu, 27 April 2006 12:48:05 +0200, Heiko J Schick wrote:
>
> + if (ehca_module->cache_pd == NULL) {

Hmm.

> + ret = kmem_cache_destroy(ehca_module->cache_pd);
> + if (ret != 0)

The " != 0" is completely superfluous. Above NULL check is a matter
of taste, this one demonstates lack of boolean algebra understanding.

> + rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
> + if (!rblock) {

Hmm. And your taste seems to change. :)

> + if (ehca_hw_level == 0) {

And since we're on the subject. Ignoring the recent discussion
involving akpm, viro and others, the kernel historically used int both
for integer and boolean, plus return values as a special kind of
"boolean with error indication attached".

For boolean, it is nicer to do things like "if (!error)", for
integers, a comparison as above is nicer. Return codes fall into the
boolean category. Pointers after kmalloc() and similar are viewed as
rich boolean by some people, but not by all.

Jörn

--
Geld macht nicht glücklich.
Glück macht nicht satt.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-04-27 14:12    [W:0.240 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site