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

Bug#619827: linux-source-2.6.38: [linux-dvb] cx88-blackbird broken (since 2.6.37)



Jonathan has provided a new patch set. (RFC in progress.)

And while testing it today an unrelated issue occurred which needs to be resolved ...

The driver's active_ref count may become negative which leads to unpredictable
behavior. (MPEG video device inaccessible, etc ...)

Here's a possible fix ...

diff -Nur a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
--- a/drivers/media/video/cx88/cx88-mpeg.c	2011-04-02 14:34:21.456569849 +0200
+++ b/drivers/media/video/cx88/cx88-mpeg.c	2011-04-02 14:32:55.467038000 +0200
@@ -642,12 +642,16 @@
 {
 	struct cx88_core *core = drv->core;
 
+	mpeg_dbg(1,"%s active driver references before release attempt: %d\n",core->name,core->active_ref);
+	
 	if (drv->advise_release && --core->active_ref == 0)
 	{
 		drv->advise_release(drv);
 		core->active_type_id = CX88_BOARD_NONE;
 		mpeg_dbg(1,"%s() Post release GPIO=%x\n", __func__, cx_read(MO_GP0_IO));
 	}
+	
+	if(core->active_ref<0) core->active_ref=0; // prevent us from getting negative ref counts!
 
 	return 0;
 }


Tests done on amd64 hardware with 2 Hauppauge HVR1300 TV cards: 
Both were independently able to tune channels and stream encoded video through
their MPEG encoder devices.

Andi.


Reply to: