Input: wacom_w8001 - handle errors from input_mt_init_slots()
authorPing Cheng <pinglinux@gmail.com>
Tue, 19 Jul 2016 18:13:17 +0000 (11:13 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 19 Jul 2016 18:42:44 +0000 (11:42 -0700)
input_mt_init_slots() may fail and we should be handling failures properly.

Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/wacom_w8001.c

index c1dac862881736246d3c9dcdfe0495f2ef5f4f92..85e95725d0dfe08c4c38fa73097c51236514dff5 100644 (file)
@@ -518,7 +518,13 @@ static int w8001_setup_touch(struct w8001 *w8001, char *basename,
                w8001->pktlen = W8001_PKTLEN_TOUCH2FG;
 
                __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit);
-               input_mt_init_slots(dev, 2, 0);
+               error = input_mt_init_slots(dev, 2, 0);
+               if (error) {
+                       dev_err(&w8001->serio->dev,
+                               "failed to initialize MT slots: %d\n", error);
+                       return error;
+               }
+
                input_set_abs_params(dev, ABS_MT_POSITION_X,
                                        0, touch.x, 0, 0);
                input_set_abs_params(dev, ABS_MT_POSITION_Y,