From: Eric Miao <eric.y.miao@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
Uli Luckas <u.luckas@road.de>,
linux-arm-kernel@lists.arm.linux.org.uk,
Marek Vasut <marek.vasut@gmail.com>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
Subject: Re: [PATCH] input: add support for generic GPIO-based matrix keypad
Date: Mon, 1 Jun 2009 11:43:57 +0800 [thread overview]
Message-ID: <f17812d70905312043q4d8e18pf9e2daaa4aeed641@mail.gmail.com> (raw)
In-Reply-To: <200905311038.23807.dmitry.torokhov@gmail.com>
On Mon, Jun 1, 2009 at 1:38 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Sunday 31 May 2009 07:29:08 Eric Miao wrote:
>> On Sun, May 31, 2009 at 10:20 PM, Russell King - ARM Linux
>>
>> <linux@arm.linux.org.uk> wrote:
>> > On Sun, May 31, 2009 at 10:12:25PM +0800, Eric Miao wrote:
>> >> +static void __devinit build_keycodes(struct matrix_keypad *keypad)
>> >> +{
>> >> + struct matrix_keypad_platform_data *pdata = keypad->pdata;
>> >> + struct input_dev *input_dev = keypad->input_dev;
>> >> + uint32_t *key;
>> >> + int i;
>> >> +
>> >> + keypad->keycodes = kzalloc(MATRIX_MAX_KEYS * sizeof(int),
>> >> GFP_KERNEL);
>> >
>> > This doesn't check for failure...
>>
>> Oops, updated (together with the release) as below:
>
> Eric, could you please send me this patch as a diff to the original
> one you sent?
>
Sorry, I used 'git commit --amend' for this and I'm not sure if I can
recover the diff. I'll paste the changed part here instead:
+ keypad->keycodes = kzalloc(MATRIX_MAX_KEYS * sizeof(int), GFP_KERNEL);
+ if (keypad->keycodes == NULL)
+ return -ENOMEM;
+
+ key = &pdata->key_map[0];
+ for (i = 0; i < pdata->key_map_size; i++, key++) {
+ keypad->keycodes[KEY_ROWCOL(*key)] = KEY_VAL(*key);
+ set_bit(KEY_VAL(*key), input_dev->keybit);
+ }
+ return 0;
returns something in 'build_keycodes()'.
+ err = build_keycodes(keypad);
+ if (err)
+ goto err_free_input;
+
...
+
+err_unregister:
+ input_unregister_device(input_dev);
+err_free_keycodes:
+ kfree(keypad->keycodes);
+err_free_input:
+ input_free_device(input_dev);
+err_free_keypad:
+ kfree(keypad);
+ return err;
add one more exiting path when build_keycodes() failed
+
+ input_unregister_device(keypad->input_dev);
+ kfree(keypad->keycodes);
+ kfree(keypad);
+ return 0;
kfree(keypad->keycodes) in matrix_keypad_remove()
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-06-01 3:43 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-07 8:00 [PATCH] input: add support for generic GPIO-based matrix keypad Eric Miao
2009-05-07 8:41 ` Trilok Soni
2009-05-07 8:48 ` Eric Miao
2009-05-07 8:51 ` Trilok Soni
2009-05-08 1:29 ` Eric Miao
2009-05-08 4:54 ` Trilok Soni
2009-05-08 5:52 ` Arve Hjønnevåg
2009-05-25 3:36 ` Trilok Soni
2009-05-25 7:05 ` Eric Miao
2009-05-27 13:26 ` Uli Luckas
2009-05-31 14:12 ` Eric Miao
2009-05-31 14:20 ` Russell King - ARM Linux
2009-05-31 14:29 ` Eric Miao
2009-05-31 17:38 ` Dmitry Torokhov
2009-06-01 3:43 ` Eric Miao [this message]
2009-05-31 17:39 ` Robert Jarzmik
2009-06-01 4:02 ` Eric Miao
2009-06-02 14:55 ` Uli Luckas
2009-06-02 15:14 ` Uli Luckas
2009-06-03 6:24 ` Eric Miao
2009-06-10 4:10 ` Trilok Soni
2009-07-04 5:54 ` Marek Vasut
2009-07-06 6:02 ` Eric Miao
2009-07-06 10:58 ` Marek Vasut
[not found] ` <f17812d70906070704s10f8eac6ybc353041e2db5a03@mail.gmail.com>
2009-06-12 4:03 ` Dmitry Torokhov
2009-06-12 13:01 ` Trilok Soni
2009-06-12 13:26 ` Eric Miao
2009-06-19 6:54 ` Trilok Soni
2009-06-29 16:26 ` Dmitry Torokhov
2009-06-30 6:43 ` Trilok Soni
2009-07-01 12:14 ` Kim Kyuwon
2009-07-09 9:46 ` Eric Miao
2009-07-09 10:01 ` Trilok Soni
2009-07-17 7:51 ` Paulius Zaleckas
2009-07-17 8:32 ` Trilok Soni
2009-07-17 9:20 ` Paulius Zaleckas
2009-07-20 7:12 ` Trilok Soni
2009-07-20 10:37 ` Eric Miao
2009-07-20 10:43 ` Trilok Soni
2009-07-20 11:43 ` Eric Miao
2009-07-21 8:00 ` Dmitry Torokhov
2009-07-21 8:26 ` Eric Miao
2009-07-21 15:58 ` Dmitry Torokhov
2009-07-27 8:54 ` Eric Miao
2009-06-03 6:06 ` Eric Miao
2009-06-03 18:06 ` Trilok Soni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f17812d70905312043q4d8e18pf9e2daaa4aeed641@mail.gmail.com \
--to=eric.y.miao@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-input@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=marek.vasut@gmail.com \
--cc=u.luckas@road.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).