From: Dmitry Torokhov Date: Mon, 28 Aug 2006 12:21:42 +0000 (+0200) Subject: hdaps: Handle errors from input_register_device X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b25a10631a81fca33a94d1f1f6960928d8e9ce63;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git hdaps: Handle errors from input_register_device HDAPS: handle errors from input_register_device() Signed-off-by: Dmitry Torokhov Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c index 42b632889dd8..8e7b5607f5a1 100644 --- a/drivers/hwmon/hdaps.c +++ b/drivers/hwmon/hdaps.c @@ -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: