HID: hid-lg: Check return values from lg[N]ff_init()
authorMichal Malý <madcatxster@devoid-pointer.net>
Wed, 8 Apr 2015 20:56:45 +0000 (22:56 +0200)
committerJiri Kosina <jkosina@suse.cz>
Thu, 7 May 2015 14:27:09 +0000 (16:27 +0200)
Check return values from lg[N]ff_init(). hid-lg did not check return values from
the lg[N]_init() functions, possibly trying to work with a device whose
initialization has failed.

Signed-off-by: Michal Malý <madcatxster@devoid-pointer.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-lg.c

index 2671de952e62d7e0aaac7c1ce45c6ebb9a485284..3f01da695d5e11e527e95f858ba3e118f88dd3b1 100644 (file)
@@ -713,13 +713,16 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
        }
 
        if (drv_data->quirks & LG_FF)
-               lgff_init(hdev);
+               ret = lgff_init(hdev);
        if (drv_data->quirks & LG_FF2)
-               lg2ff_init(hdev);
+               ret = lg2ff_init(hdev);
        if (drv_data->quirks & LG_FF3)
-               lg3ff_init(hdev);
+               ret = lg3ff_init(hdev);
        if (drv_data->quirks & LG_FF4)
-               lg4ff_init(hdev);
+               ret = lg4ff_init(hdev);
+
+       if (ret)
+               goto err_free;
 
        return 0;
 err_free: