[PATCH] media: au0828 fix au0828_v4l2_device_register() to not unlock and free

From: Shuah Khan
Date: Mon Mar 28 2016 - 20:25:37 EST


au0828_v4l2_device_register() unlocks au0828_dev->lock and frees au0828
dev in error legs before return. au0828_usb_probe() does the same when
au0828_v4l2_device_register() returns error.

Fix au0828_v4l2_device_register() to not to unlock and free in its error
legs.

Signed-off-by: Shuah Khan <shuahkh@xxxxxxxxxxxxxxx>
---
drivers/media/usb/au0828/au0828-video.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 32d7db9..7d0ec4c 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -679,8 +679,6 @@ int au0828_v4l2_device_register(struct usb_interface *interface,
if (retval) {
pr_err("%s() v4l2_device_register failed\n",
__func__);
- mutex_unlock(&dev->lock);
- kfree(dev);
return retval;
}

@@ -691,8 +689,6 @@ int au0828_v4l2_device_register(struct usb_interface *interface,
if (retval) {
pr_err("%s() v4l2_ctrl_handler_init failed\n",
__func__);
- mutex_unlock(&dev->lock);
- kfree(dev);
return retval;
}
dev->v4l2_dev.ctrl_handler = &dev->v4l2_ctrl_hdl;
--
2.5.0