Input: ims-pcu - fix a memory leak on error
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index 1b044b9..e204f26 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -292,7 +292,8 @@
if (!gamepad || !input) {
dev_err(pcu->dev,
"Not enough memory for gamepad device\n");
- return -ENOMEM;
+ error = -ENOMEM;
+ goto err_free_mem;
}
gamepad->input = input;
@@ -1156,7 +1157,7 @@
{
struct usb_interface *intf = to_usb_interface(dev);
struct ims_pcu *pcu = usb_get_intfdata(intf);
- const struct firmware *fw;
+ const struct firmware *fw = NULL;
int value;
int error;