HID: hid-lg: Check return values from lg[N]ff_init()
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>
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index 2671de9..3f01da6 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -713,13 +713,16 @@
}
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: