lkml.org 
[lkml]   [2010]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] Input: stmpe-ts - return -ENOMEM if memory allocation fail
On Fri, Sep 03, 2010 at 09:32:13AM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Basically correct. Should be simpler to just use

int ret = -ENOMEM;

though.

> ---
> drivers/input/touchscreen/stmpe-ts.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
> index 0339d1d..e715b27 100644
> --- a/drivers/input/touchscreen/stmpe-ts.c
> +++ b/drivers/input/touchscreen/stmpe-ts.c
> @@ -276,12 +276,16 @@ static int __devinit stmpe_input_probe(struct platform_device *pdev)
> return ts_irq;
>
> ts = kzalloc(sizeof(*ts), GFP_KERNEL);
> - if (!ts)
> + if (!ts) {
> + ret = -ENOMEM;
> goto err_out;
> + }
>
> idev = input_allocate_device();
> - if (!idev)
> + if (!idev) {
> + ret = -ENOMEM;
> goto err_free_ts;
> + }
>
> platform_set_drvdata(pdev, ts);
> ts->stmpe = stmpe;
> --
> 1.7.2
>
>
>
>

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2010-09-03 23:37    [W:0.078 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site