From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xenotime.net (xenotime.net [66.160.160.81]) by ozlabs.org (Postfix) with SMTP id 2190967CA0 for ; Thu, 28 Jul 2005 04:18:32 +1000 (EST) Received: from shark.he.net ([127.0.0.9]) by xenotime.net for ; Wed, 27 Jul 2005 11:08:28 -0700 Message-Id: <1122487708.20267@shark.he.net> Date: Wed, 27 Jul 2005 11:08:28 -0700 From: "Randy Dunlap" To: Andy Fleming , Francois Romieu , Netdev , linuxppc-embedded MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Subject: Re: [RFC PATCH 1/4] PHY Abstraction Layer III (now with more splitiness) List-Id: Linux on Embedded PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , > On Jul 25, 2005, at 16:06, Francois Romieu wrote: > > > >> +int mdiobus_register(struct mii_bus *bus) > >> +{ > >> + int i; > >> + int err = 0; > >> + > >> + spin_lock_init(&bus->mdio_lock); > >> + > >> + if (NULL == bus || NULL == bus->name || > >> + NULL == bus->read || > >> + NULL == bus->write) > >> > > > > Be spartan: > > if (!bus || !bus->name || !bus->read || !bus->write) > > > I think we have to agree to disagree here. I could be convinced, but > I'm partial to using NULL explicitly. But there are 2 issues here (at least). One is to use NULL or not. The other is using (constant == var) or (var == constant). It's not described in CodingStlye afaik, but most recent email on the subject strongly prefers (var == constant) [in my unscientific survey -- of bits in my head]. So using the suggested style will fix both of these. :) > >> + /* Otherwise, we allocate the device, and initialize the > >> + * default values */ > >> + dev = kmalloc(sizeof(*dev), GFP_KERNEL); > >> + > >> + if (NULL == dev) { > >> + errno = -ENOMEM; > >> + return NULL; > >> + } > >> + > >> + memset(dev, 0, sizeof(*dev)); > >> > > > > The kernel provides kcalloc. > > > I went looking for it, and found it in fs/cifs/misc.c. I'm hesitant > to link to a function defined in the filesystem code just to save 1 > line of code It's more global than that. ~Randy