Input: stmpe-ts - return -ENOMEM when memory allocation fails
authorAxel Lin <axel.lin@gmail.com>
Fri, 3 Sep 2010 02:54:27 +0000 (19:54 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 5 Sep 2010 19:09:12 +0000 (12:09 -0700)
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/touchscreen/stmpe-ts.c

index 0339d1d0d29ebfd3d056ae238e38d52b1042ef3e..ae88e13c99ff5194f88bb48f0096daf820c9bf47 100644 (file)
@@ -268,7 +268,7 @@ static int __devinit stmpe_input_probe(struct platform_device *pdev)
        struct stmpe_touch *ts;
        struct input_dev *idev;
        struct stmpe_ts_platform_data *ts_pdata = NULL;
-       int ret = 0;
+       int ret;
        int ts_irq;
 
        ts_irq = platform_get_irq_byname(pdev, "FIFO_TH");
@@ -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;