Re: [PATCH] Input: marix-keymap - automatically allocate memory for keymap
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2012-11-14 16:37:12
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2012-11-14 16:37:12
Hi Alban, On Wed, Nov 14, 2012 at 10:40:59AM +0100, Alban Bedel wrote:
On Thu, 8 Nov 2012 08:45:21 -0800 Dmitry Torokhov [off-list ref] wrote:quoted
+ if (!keymap) { + keymap = devm_kzalloc(input_dev->dev.parent, + max_keys * sizeof(*keymap), + GFP_KERNEL);In my tree GFP_KERNEL isn't defined at that point. Is an include missing in this patch or is my tree (3.6+some next cherry picks) missing a commit?
No, I apparetnly had an older tree when I created a patch, i have since added include/linux/gfp.h
quoted
+ if (!keymap) { + dev_err(input_dev->dev.parent, + "Unable to allocate memory for keymap"); + return -ENOMEM; + } + } + input_dev->keycode = keymap; input_dev->keycodesize = sizeof(*keymap); - input_dev->keycodemax = rows << row_shift; + input_dev->keycodemax = max_keys; __set_bit(EV_KEY, input_dev->evbit);Otherwise that look good to me.
Great, I am putting you down as reviewed-by then. Thanks. -- Dmitry