Thread (24 messages) 24 messages, 7 authors, 2018-06-20

Re: [PATCH v2 5/5] Input: evdev - Switch to bitmap_zalloc()

From: Joe Perches <joe@perches.com>
Date: 2018-06-16 19:16:37
Also in: dm-devel, linux-raid, lkml

On Sat, 2018-06-16 at 21:45 +0300, Andy Shevchenko wrote:
On Sat, Jun 16, 2018 at 12:46 AM Yury Norov [off-list ref] wrote:
quoted
On Fri, Jun 15, 2018 at 04:20:17PM +0300, Andy Shevchenko wrote:
quoted
Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.
quoted
quoted
+       mem = bitmap_alloc(maxbit, GFP_KERNEL);
        if (!mem)
                return -ENOMEM;
But in commit message you say you switch to bitmap_zalloc(). IIUC
bitmap_alloc() is OK here. But could you please update comment to
avoid confusing.
There are two places, one with alloc, another with zalloc.
I will clarify this in commit message of next version.
quoted
quoted
+       mask = bitmap_zalloc(cnt, GFP_KERNEL);
        if (!mask)
                return -ENOMEM;

        error = bits_from_user(mask, cnt - 1, codes_size, codes, compat);
If my understanding of bits_from_user() correct, here you can also use
bitmap_alloc(), true?
Also it might be useful to have a separate bitmap_from_user
to alloc and copy.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help