From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] Input: gpio_keys - convert to use devm_*
Date: Mon, 28 Apr 2014 12:40:43 +0300 [thread overview]
Message-ID: <1398678043.11914.284.camel@smile.fi.intel.com> (raw)
In-Reply-To: <20140426044346.GB27425@core.coreip.homeip.net>
On Fri, 2014-04-25 at 21:43 -0700, Dmitry Torokhov wrote:
> On Fri, Apr 25, 2014 at 07:22:16PM +0300, Andy Shevchenko wrote:
> > This makes the error handling much more simpler than open-coding everything and
> > in addition makes the probe function smaller an tidier.
[]
> > - pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button),
> > - GFP_KERNEL);
> > - if (!pdata) {
> > - error = -ENOMEM;
> > - goto err_out;
> > - }
> > + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> > + if (!pdata)
> > + return ERR_PTR(-ENOMEM);
> > +
> > + pdata->buttons = devm_kcalloc(dev, nbuttons, sizeof (*button),
> > + GFP_KERNEL);
> > + if (!pdata->buttons)
> > + return ERR_PTR(-ENOMEM);
>
> Why are we splitting the allocation in 2?
Just for logical distinguishing, but I'm okay with one allocation.
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2014-04-28 9:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-25 16:22 [PATCH v3 0/3] Input: gpio-keys - clean up series Andy Shevchenko
2014-04-25 16:22 ` [PATCH v3 1/3] Input: gpio_keys - use dev instead of pdev in gpio_keys_setup_key() Andy Shevchenko
2014-04-25 21:21 ` Dmitry Torokhov
2014-04-28 9:42 ` Andy Shevchenko
2014-04-25 16:22 ` [PATCH v3 2/3] Input: gpio_keys - convert to use devm_* Andy Shevchenko
2014-04-26 4:43 ` Dmitry Torokhov
2014-04-28 9:40 ` Andy Shevchenko [this message]
2014-04-25 16:22 ` [PATCH v3 3/3] Input: gpio_keys - convert struct descriptions to kernel-doc Andy Shevchenko
2014-04-26 4:41 ` Dmitry Torokhov
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=1398678043.11914.284.camel@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome