V4L/DVB (4413): Konicawc - handle errors from input_register_device()
authorDmitry Torokhov <dtor@insightbb.com>
Tue, 8 Aug 2006 18:48:06 +0000 (15:48 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Tue, 26 Sep 2006 14:53:33 +0000 (11:53 -0300)
Compile-tested only (no hardware)

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/usbvideo/konicawc.c

index 6f31ecc88843d16c7de882a8ee7e9dd28f538375..4eee8be88314104524eafcafce16a263e5400b9b 100644 (file)
@@ -222,6 +222,7 @@ static void konicawc_adjust_picture(struct uvd *uvd)
 static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev)
 {
        struct input_dev *input_dev;
+       int error;
 
        usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname));
        strncat(cam->input_physname, "/input0", sizeof(cam->input_physname));
@@ -242,7 +243,13 @@ static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev
 
        input_dev->private = cam;
 
-       input_register_device(cam->input);
+       error = input_register_device(cam->input);
+       if (error) {
+               warn("Failed to register camera's input device, err: %d\n",
+                    error);
+               input_free_device(cam->input);
+               cam->input = NULL;
+       }
 }
 
 static void konicawc_unregister_input(struct konicawc *cam)