lkml.org 
[lkml]   [2018]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] platform/x86: acer-wmi: use true and false for boolean values
Date
From: Andy Shevchenko
> Sent: 05 August 2018 11:26
>
> On Sun, Aug 5, 2018 at 3:18 AM, Gustavo A. R. Silva
> <gustavo@embeddedor.com> wrote:
> > Return statements in functions returning bool should use true or false
> > instead of an integer value.
> >
> > This code was detected with the help of Coccinelle.
>
> > static bool has_cap(u32 cap)
> > {
> > if ((interface->capability & cap) != 0)
> > - return 1;
> > + return true;
> >
> > - return 0;
> > + return false;
> > }
>
> this entire function can be oneliner:
>
> return !!(...);

Why the !! ?? Just:
return (interface->capability & cap) != 0;

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
\
 
 \ /
  Last update: 2018-08-06 18:39    [W:0.046 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site