lkml.org 
[lkml]   [2018]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v5 2/2] mtd: rawnand: use bit-wise majority to recover the contents of ONFI parameter
On Thu, May 10, 2018 at 3:03 PM, Boris Brezillon
<boris.brezillon@bootlin.com> wrote:

>> +#define GET_BIT(bit, val) (((val) >> (bit)) & 0x01)
>
> Not sure we need that macro, see below.

+1. We have too many nice helpers for bit manipulations
(for_each_set_bit() as an example).


> for (k = 0; k < nbufs; k++) {
> const u8 *srcbuf = srcbufs[j];
>
> if (srcbuf[i] & BIT(k))
> m++;
> }

...which is effectively hweightXX().

>> - p = kzalloc(sizeof(*p), GFP_KERNEL);
>> + p = kzalloc((sizeof(*p) * 3), GFP_KERNEL);
>> if (!p)
>> return -ENOMEM;

...which is kcalloc().


--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2018-05-14 19:55    [W:0.083 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site