From: Santosh Kumar Singh Date: Mon, 19 Dec 2016 17:10:58 +0000 (-0200) Subject: [media] tm6000: Clean up file handle in open() error path X-Git-Tag: v4.11-rc1~132^2~148 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1e071039b1535e2a781acc750681deb2eb838565;p=karo-tx-linux.git [media] tm6000: Clean up file handle in open() error path Fix to avoid possible memory leak and exit file handle in error paths. Signed-off-by: Santosh Kumar Singh Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c index 3367a3b72530..c4fdc1fa32ef 100644 --- a/drivers/media/usb/tm6000/tm6000-video.c +++ b/drivers/media/usb/tm6000/tm6000-video.c @@ -1371,8 +1371,11 @@ static int __tm6000_open(struct file *file) /* initialize hardware on analog mode */ rc = tm6000_init_analog_mode(dev); - if (rc < 0) + if (rc < 0) { + v4l2_fh_exit(&fh->fh); + kfree(fh); return rc; + } dev->mode = TM6000_MODE_ANALOG;