public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: Steve Wise <swise@opengridcomputing.com>
Cc: Roland Dreier <rdreier@cisco.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] iWARP Connection Manager.
Date: Wed, 31 May 2006 14:01:00 -0700	[thread overview]
Message-ID: <20060531140100.36024296@localhost.localdomain> (raw)
In-Reply-To: <1149109080.7469.15.camel@stevo-desktop>

On Wed, 31 May 2006 15:58:00 -0500
Steve Wise <swise@opengridcomputing.com> 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.

  reply	other threads:[~2006-05-31 21:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-31 18:26 [PATCH 0/2][RFC] iWARP Core Support Steve Wise
2006-05-31 18:26 ` [PATCH 1/2] iWARP Connection Manager Steve Wise
2006-05-31 18:40   ` Stephen Hemminger
2006-05-31 19:24     ` Roland Dreier
2006-05-31 20:47       ` Muli Ben-Yehuda
2006-05-31 20:58       ` Steve Wise
2006-05-31 21:01         ` Stephen Hemminger [this message]
2006-05-31 21:54           ` Roland Dreier
2006-05-31 22:22             ` Steve Wise
2006-05-31 22:22   ` Sean Hefty
2006-06-01 17:00     ` Steve Wise
2006-06-01 21:09       ` Sean Hefty
2006-06-01 22:21         ` [openib-general] " Tom Tucker
2006-06-01 17:11     ` Tom Tucker
2006-05-31 18:26 ` [PATCH 2/2] iWARP Core Changes Steve Wise
2006-05-31 18:36   ` Stephen Hemminger
2006-05-31 19:17   ` Roland Dreier
2006-05-31 20:30     ` Steve Wise
2006-05-31 20:32       ` Roland Dreier
2006-05-31 21:26   ` Sean Hefty

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=20060531140100.36024296@localhost.localdomain \
    --to=shemminger@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdreier@cisco.com \
    --cc=swise@opengridcomputing.com \
    /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