diff mbox

[v3,20/21] media: media: dvb-frontend fix enable_source error legs

Message ID e1c8d1441a4add64e53b01899b2a9d63d1a868c6.1442937669.git.shuahkh@osg.samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shuah Khan Sept. 22, 2015, 5:19 p.m. UTC
When enable_source finds the tuner busy, do dvb_generic_release().
In addition, when dvb_frontend_start() fails, call disable_source
to release tuner.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 drivers/media/dvb-core/dvb_frontend.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index c06dd61..67e30ae 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -2503,13 +2503,13 @@  static int dvb_frontend_open(struct inode *inode, struct file *file)
 			if (ret) {
 				dev_err(fe->dvb->device,
 					"Tuner is busy. Error %d\n", ret);
-				goto err1;
+				goto err2;
 			}
 		}
 #endif
 		ret = dvb_frontend_start (fe);
 		if (ret)
-			goto err2;
+			goto err3;
 
 		/*  empty event queue */
 		fepriv->events.eventr = fepriv->events.eventw = 0;
@@ -2519,6 +2519,11 @@  static int dvb_frontend_open(struct inode *inode, struct file *file)
 		mutex_unlock (&adapter->mfe_lock);
 	return ret;
 
+err3:
+#ifdef CONFIG_MEDIA_CONTROLLER_DVB
+	if (fe->dvb->mdev && fe->dvb->mdev->disable_source)
+		fe->dvb->mdev->disable_source(dvbdev->entity);
+#endif
 err2:
 	dvb_generic_release(inode, file);
 err1: