Mailing List archive

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

[linux-dvb] Re: cx24110 segfault with new bttv driver



On Wed, Nov 17, 2004 at 08:17:30AM +0100, Adam Szalkowski wrote:
> Hi again,
> 
> with linux-2.6.10-rc2 (with just a little ck2 patch added) I got now the same 
> problem. Seems they merged rc2 with a buggy version of bttv.

> Nov 16 08:08:12 baldur kernel: ------------[ cut here ]------------
> Nov 16 08:08:12 baldur kernel: kernel BUG at drivers/media/dvb/frontends/cx24110.c:694!

No, it's bug in the cx24110.c module.  linuxtv cvs has this fixed.  A
older band-aid fix is attached below, not sure whenever that one applies
to 2.6.10-rc2 through.

  Gerd

--- linux-2.6.8/drivers/media/dvb/frontends/cx24110.c~	2004-10-04 14:54:33.000000000 +0200
+++ linux-2.6.8/drivers/media/dvb/frontends/cx24110.c	2004-10-04 15:17:30.412147141 +0200
@@ -690,17 +690,6 @@
 		kfree(state);
 		return ret;
 	}
-
-	BUG_ON(!state->dvb);
-
-	if ((ret = dvb_register_frontend(cx24110_ioctl, state->dvb, state,
-					     &cx24110_info, THIS_MODULE))) {
-		i2c_detach_client(client);
-		kfree(client);
-		kfree(state);
-		return ret;
-	}
-
 	return 0;
 }
 
@@ -708,7 +697,10 @@
 {
 	struct cx24110_state *state = i2c_get_clientdata(client);
 
-	dvb_unregister_frontend(cx24110_ioctl, state->dvb);
+	if (NULL != state->dvb) {
+		dvb_unregister_frontend(cx24110_ioctl, state->dvb);
+		state->dvb = NULL;
+	}
 	i2c_detach_client(client);
 	BUG_ON(state->dvb);
 	kfree(client);
@@ -719,12 +711,25 @@
 static int command(struct i2c_client *client, unsigned int cmd, void *arg)
 {
 	struct cx24110_state *state = i2c_get_clientdata(client);
+	int rc;
 
 	switch(cmd) {
 	case FE_REGISTER:
+		if (NULL != state->dvb)
+			break;
 		state->dvb = arg;
+		rc = dvb_register_frontend(cx24110_ioctl, state->dvb, state,
+					   &cx24110_info, THIS_MODULE);
+		if (0 != rc) {
+			printk("cx24110: dvb_register_frontend failed with rc=%d\n",rc);
+			state->dvb = NULL;
+			return rc;
+		}
 		break;
 	case FE_UNREGISTER:
+		if (NULL == state->dvb)
+			break;
+		dvb_unregister_frontend(cx24110_ioctl, state->dvb);
 		state->dvb = NULL;
 		break;
 	default:




Home | Main Index | Thread Index