lkml.org 
[lkml]   [2012]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] char/tpm: Use true and false for bools
On Thu, Nov 29, 2012 at 01:54:52PM -0800, Joe Perches wrote:
> On Thu, 2012-11-29 at 22:08 +0100, Peter Huewe wrote:
> > Bool initializations should use true and false. Bool tests don't need
> > comparisons
> []
> > .v3 for this tiny patch... shame on me.
>
> Don't be silly...
>
> > diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> []
> > @@ -545,7 +545,7 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
> > rc = -ENODEV;
> > goto out_err;
> > }
> > - itpm = (probe == 0) ? 0 : 1;
> > + itpm = !!probe;
>
> Even more trivia:
>
> This !! isn't necessary as ints assigned to bool are converted
> by the compiler to 0 or 1.

Good to know, thanks Joe!

Kent

>
>



\
 
 \ /
  Last update: 2012-11-29 23:41    [W:0.040 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site