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]
Date:	Tue, 02 Dec 2014 15:48:35 -0800
From:	Joe Perches <joe@...ches.com>
To:	Peter Hüwe <PeterHuewe@....de>
Cc:	Aaro Koskinen <aaro.koskinen@....fi>,
	tpmdd-devel@...ts.sourceforge.net,
	Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
	christophe.ricard@...il.com, josh.triplett@...el.com,
	linux-api@...r.kernel.org, Ashley Lai <ashley@...leylai.com>,
	linux-kernel@...r.kernel.org, jason.gunthorpe@...idianresearch.com,
	trousers-tech@...ts.sourceforge.net
Subject: Re: [tpmdd-devel] [PATCH v8 0/8] TPM 2.0 support

On Wed, 2014-12-03 at 00:33 +0100, Peter Hüwe wrote:
> Am Mittwoch, 3. Dezember 2014, 00:24:43 schrieb Aaro Koskinen:
> > On Wed, Dec 03, 2014 at 12:21:07AM +0100, Peter Hüwe wrote:
> > > --- a/drivers/char/tpm/tpm_i2c_nuvoton.c
> > > +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > > @@ -605,10 +605,8 @@ static int i2c_nuvoton_probe(struct i2c_client
> > > *client,
> > > 
> > >  		return -ENODEV;
> > >  	
> > >  	rc = tpm_chip_register(chip);
> > > 
> > > -	if (rc)
> > > -		return rc;
> > > 
> > > -	return 0;
> > > +	return rc;
> > 
> > Maybe just return tpm_chip_register(chip)?
> 
> Even better.

The pattern:

	foo = bar();
	if (foo)
		return foo;

	return 0;

is fairly common.

There are a few hundred in the kernel.

$ grep-2.5.4 -nrP --include=*.[ch] "\b(\w+)\s*=\s*[^;]*;\s*if\s*\(\s*\1\s*\)\s*return\s*\1\s*;\s*return\s*0;" * | \
  grep -oP '^.+:\d+:' | \
  wc -l
308


--
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