From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: pramod gurav <pramod.gurav.etc@gmail.com>
Cc: linux-input@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Pramod Gurav <pramod.gurav@smartplayin.com>,
Lejun Zhu <lejun.zhu@linux.intel.com>,
Sachin Kamat <sachin.kamat@linaro.org>
Subject: Re: [PATCH v2] Input: soc_button_array: Remove kfree on data allocated with devm_zalloc
Date: Mon, 28 Jul 2014 00:10:16 -0700 [thread overview]
Message-ID: <9c56a845-2005-49c5-90c3-1d22a89fad20@email.android.com> (raw)
In-Reply-To: <CAMf-jSm1d0wAJ3C_yFhqnoDPSLqeDcc-ow0D=bwmLUcC9sXjLA@mail.gmail.com>
On July 27, 2014 11:50:41 PM PDT, pramod gurav <pramod.gurav.etc@gmail.com> wrote:
>Hi Dmitry,
>
>Thanks for the review.
>
>On Fri, Jul 25, 2014 at 9:52 PM, Dmitry Torokhov
><dmitry.torokhov@gmail.com> wrote:
>> Hi Pramod,
>>
>> On Fri, Jul 25, 2014 at 05:04:34PM +0530, pramod.gurav.etc@gmail.com
>wrote:
>>> From: Pramod Gurav <pramod.gurav@smartplayin.com>
>>>
>>> This patch does below:
>>> - Removes kfree done on data allocated with devm_zalloc in probe
>>> path of the driver.
>>> - Adds a check on return value from devm_kzalloc which was missing
>>>
>>> CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>>> CC: Lejun Zhu <lejun.zhu@linux.intel.com>
>>> CC: Sachin Kamat <sachin.kamat@linaro.org>
>>>
>>> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
>>> ---
>>> drivers/input/misc/soc_button_array.c | 17 +++++++----------
>>> 1 file changed, 7 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/input/misc/soc_button_array.c
>b/drivers/input/misc/soc_button_array.c
>>> index 5a6334b..fc64ec6 100644
>>> --- a/drivers/input/misc/soc_button_array.c
>>> +++ b/drivers/input/misc/soc_button_array.c
>>> @@ -83,6 +83,9 @@ soc_button_device_create(struct pnp_dev *pdev,
>>> sizeof(*gpio_keys_pdata) +
>>> sizeof(*gpio_keys) *
>MAX_NBUTTONS,
>>> GFP_KERNEL);
>>> + if (!gpio_keys_pdata)
>>> + return ERR_PTR(-ENOMEM);
>>
>> OK, that makes sense.
>>
>>> +
>>> gpio_keys = (void *)(gpio_keys_pdata + 1);
>>>
>>> for (info = button_info; info->name; info++) {
>>> @@ -102,20 +105,16 @@ soc_button_device_create(struct pnp_dev *pdev,
>>> n_buttons++;
>>> }
>>>
>>> - if (n_buttons == 0) {
>>> - error = -ENODEV;
>>> - goto err_free_mem;
>>> - }
>>> + if (n_buttons == 0)
>>> + return ERR_PTR(-ENODEV);
>>
>> But that one and the rest don't, because failure in
>> soc_button_device_create() does not necessarily mean that binding for
>> the whole device will fail. In this case we do not want unused memory
>> hang around.
>Agree. Should resend the patch with only the error check after mem
>allocation and will be little more careful while sending any such
>change. :)
No need to resend, I picked out the good bits and applied.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2014-07-28 7:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 11:34 pramod.gurav.etc
2014-07-25 16:22 ` Dmitry Torokhov
2014-07-28 6:50 ` pramod gurav
2014-07-28 7:10 ` Dmitry Torokhov [this message]
2014-07-28 7:24 ` pramod gurav
-- strict thread matches above, loose matches on Subject: below --
2014-07-25 9:12 pramod.gurav.etc
2014-07-25 10:29 ` Sachin Kamat
2014-07-25 10:44 ` pramod gurav
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=9c56a845-2005-49c5-90c3-1d22a89fad20@email.android.com \
--to=dmitry.torokhov@gmail.com \
--cc=lejun.zhu@linux.intel.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pramod.gurav.etc@gmail.com \
--cc=pramod.gurav@smartplayin.com \
--cc=sachin.kamat@linaro.org \
/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
all inboxes | Powered by JetHome®