hdaps: Handle errors from input_register_device
authorDmitry Torokhov <dtor@insightbb.com>
Mon, 28 Aug 2006 12:21:42 +0000 (14:21 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 28 Sep 2006 22:31:12 +0000 (15:31 -0700)
HDAPS: handle errors from input_register_device()

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/hwmon/hdaps.c

index 42b6328..8e7b560 100644 (file)
@@ -587,7 +587,9 @@ static int __init hdaps_init(void)
        input_set_abs_params(hdaps_idev, ABS_Y,
                        -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT);
 
-       input_register_device(hdaps_idev);
+       ret = input_register_device(hdaps_idev);
+       if (ret)
+               goto out_idev;
 
        /* start up our timer for the input device */
        init_timer(&hdaps_timer);
@@ -598,6 +600,8 @@ static int __init hdaps_init(void)
        printk(KERN_INFO "hdaps: driver successfully loaded.\n");
        return 0;
 
+out_idev:
+       input_free_device(hdaps_idev);
 out_group:
        sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group);
 out_device: