[linux-dvb] [patch] fix two minor issues in dvb_core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi
i recently stumbled over these two little bugs in the dvb_core code:
1.
As the FE_SET_FRONTEND ioctl is asynchronous it is not guaranteed that 
the tuner is already reconfigured when the next ioctl occurs. In case of 
the FE_READ_STATUS ioctl this would return the signal status of the 
previous,now obsolete tuning to the user. Which is kind of bad for apps 
which do something like:
tune();
while(!has_lock())
     sleep(500);
read_data();
Prevent this by automatically returning zero if frontend state is FE_RETUNE.

2.
In dvb_dmxdev_filter_start if we go out because of an error, release 
previously allocated demux_feed.

Signed-off-by: Peter Beutner <p.beutner@xxxxxxx>
-------------- next part --------------
Index: linux/drivers/media/dvb/dvb-core/dvb_frontend.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-core/dvb_frontend.c,v
retrieving revision 1.108
diff -p -u -r1.108 dvb_frontend.c
--- linux/drivers/media/dvb/dvb-core/dvb_frontend.c	13 May 2005 23:08:22 -0000	1.108
+++ linux/drivers/media/dvb/dvb-core/dvb_frontend.c	4 Jun 2005 16:20:02 -0000
@@ -627,11 +627,21 @@ static int dvb_frontend_ioctl(struct ino
 		break;
 	}
 
-	case FE_READ_STATUS:
+	case FE_READ_STATUS: {
+		fe_status_t* status = parg;
+		
+		/* if retune was requested but hasn't occured yet, prevent 
+		 * that user get signal state from previous tuning */
+		if(fepriv->state == FESTATE_RETUNE) {
+			err=0;
+			*status = 0;
+			break;
+		} 
+		
 		if (fe->ops->read_status)
-			err = fe->ops->read_status(fe, (fe_status_t*) parg);
+			err = fe->ops->read_status(fe, status);
 		break;
-
+	}
 	case FE_READ_BER:
 		if (fe->ops->read_ber)
 			err = fe->ops->read_ber(fe, (__u32*) parg);
Index: linux/drivers/media/dvb/dvb-core/dmxdev.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-core/dmxdev.c,v
retrieving revision 1.40
diff -p -u -r1.40 dmxdev.c
--- linux/drivers/media/dvb/dvb-core/dmxdev.c	5 Apr 2005 00:54:19 -0000	1.40
+++ linux/drivers/media/dvb/dvb-core/dmxdev.c	2 Jun 2005 21:53:56 -0000
@@ -669,8 +669,10 @@ static int dvb_dmxdev_filter_start(struc
 
 		ret = filter->feed.ts->start_filtering(filter->feed.ts);
 
-		if (ret < 0)
+		if (ret < 0) {
+			dmxdev->demux->release_ts_feed(dmxdev->demux, *tsfeed);
 			return ret;
+		}
 
 		break;
 	}

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux