[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1398678043.11914.284.camel@smile.fi.intel.com>
Date: Mon, 28 Apr 2014 12:40:43 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/3] Input: gpio_keys - convert to use devm_*
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@...ux.intel.com>
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists