lkml.org 
[lkml]   [2017]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 4/7] gpio: mockup: improve readability
On Tue, May 30, 2017 at 11:58 AM, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> We currently shift bits here and there without actually explaining
> what we're doing. Add some helper variables with names indicating
> their purpose to improve the code readability.

> + /* Each chip is described by two values. */
> + num_chips = gpio_mockup_params_nr / 2;
> +
> + chips = devm_kzalloc(dev, sizeof(*chips) * num_chips, GFP_KERNEL);

It's effectively
devm_kcalloc()
or
devm_kmalloc_array()
depending on the requirement of zeroing a memory chunks.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2017-05-30 20:56    [W:0.117 / U:1.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site