lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120623191051.GF5333@mwanda>
Date:	Sat, 23 Jun 2012 22:10:51 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	"devendra.aaru" <devendra.aaru@...il.com>
Cc:	Joe Perches <joe@...ches.com>, devel@...verdev.osuosl.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org,
	"Justin P. Mattock" <justinmattock@...il.com>
Subject: Re: [PATCH V2 1/3] staging/rtl8192u: fix coding style problems

On Sun, Jun 24, 2012 at 12:04:12AM +0530, devendra.aaru wrote:
> Hi Joe,
> 
> On Thu, Jun 21, 2012 at 4:48 AM, Joe Perches <joe@...ches.com> wrote:
> > On Wed, 2012-06-20 at 16:08 -0700, Greg Kroah-Hartman wrote:
> >> On Wed, Jun 20, 2012 at 12:35:42AM +0530, Devendra Naga wrote:
> >> > fixed some of the coding style problems reported by checkpatch
> > []
> >> > @@ -66,11 +69,10 @@ short eprom_r(struct net_device *dev)
> >> >  {
> >> >     short bit;
> >> >
> >> > -   bit=(read_nic_byte_E(dev, EPROM_CMD) & (1<<EPROM_R_SHIFT) );
> >> > +   bit = (read_nic_byte_E(dev, EPROM_CMD) & (1<<EPROM_R_SHIFT));
> >> >     udelay(EPROM_DELAY);
> >> >
> >> > -   if(bit) return 1;
> >> > -   return 0;
> >> > +   return !!bit;
> >>
> >> Oh come on, really?  !! is more "clear" here?
> >
> > Depends on the reader.  !! is pretty common.
> >
> >> No, please be painfully obvious, that's the only way to write kernel
> >> code.  Not like this.
> >
> > I'd just make the return a bool instead.
> >
>  taking another variable and assign it like bool ret = !!bit, and
> returning ret?, i think this doesn't look better.

*eye roll*

	if (bit)
		return 1;
	return 0;

regards,
dan carpenter


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ