Re: [PATCH 1/2] iWARP Connection Manager.
- From: Stephen Hemminger <shemminger@xxxxxxxx>
- Date: Wed, 31 May 2006 14:01:00 -0700
On Wed, 31 May 2006 15:58:00 -0500
Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx> wrote:
On Wed, 2006-05-31 at 12:24 -0700, Roland Dreier wrote:
+ cm_id_priv = kzalloc(sizeof *cm_id_priv, GFP_KERNEL);
Please put paren's after sizeof, it is not required by C but it
is easier to read.
I disagree -- I hate seeing sizeof look like a function call.
For the most part, drivers/infiniband/core uses sizeof without
parentheses. So I think the correct answer here is to keep the iwcm.c
file in line with the rest of the core.
Make yours right, Bunk will "fix" infiniband core. The kernel style
matters not the subsystem. In Documentation/CodingStyle
Chapter 13: Allocating memory
The kernel provides the following general purpose memory allocators:
kmalloc(), kzalloc(), kcalloc(), and vmalloc(). Please refer to the API
documentation for further information about them.
The preferred form for passing a size of a struct is the following:
p = kmalloc(sizeof(*p), ...);
The alternative form where struct name is spelled out hurts readability and
introduces an opportunity for a bug when the pointer variable type is changed
but the corresponding sizeof that is passed to a memory allocator is not.
Casting the return value which is a void pointer is redundant. The
conversion from void pointer to any other pointer type is guaranteed by
the C programming language.
-
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/
- Follow-Ups:
- Re: [PATCH 1/2] iWARP Connection Manager.
- From: Roland Dreier
- Re: [PATCH 1/2] iWARP Connection Manager.
- References:
- [PATCH 0/2][RFC] iWARP Core Support
- From: Steve Wise
- [PATCH 1/2] iWARP Connection Manager.
- From: Steve Wise
- Re: [PATCH 1/2] iWARP Connection Manager.
- From: Stephen Hemminger
- Re: [PATCH 1/2] iWARP Connection Manager.
- From: Roland Dreier
- Re: [PATCH 1/2] iWARP Connection Manager.
- From: Steve Wise
- [PATCH 0/2][RFC] iWARP Core Support
- Prev by Date: Re: linux-2.6 x86_64 kgdb issue
- Next by Date: Re: Adaptive Readahead V14 - statistics question...
- Previous by thread: Re: [PATCH 1/2] iWARP Connection Manager.
- Next by thread: Re: [PATCH 1/2] iWARP Connection Manager.
- Index(es):