The patch number 8071 was added via Oliver Endriss <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Oliver Endriss  <[EMAIL PROTECTED]>
tda10023: Fix possible kernel oops during initialisation


If the i2c write fails during initialisation, an oops happens
because state->frontend.dvb is still undefined. Fixed.

Thanks to Sigmund Augdal for reporting this bug,
and to Hartmut Birr for suggesting the fix.

Signed-off-by: Oliver Endriss <[EMAIL PROTECTED]>
Thanks-to: Sigmund Augdal <[EMAIL PROTECTED]>
Thanks-to: Hartmut Birr <[EMAIL PROTECTED]>


---

 linux/drivers/media/dvb/frontends/tda10023.c |   20 +++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff -r 4012ea1a6a06 -r 6fe4ffe24ba5 
linux/drivers/media/dvb/frontends/tda10023.c
--- a/linux/drivers/media/dvb/frontends/tda10023.c      Fri Jun 13 23:58:08 
2008 -0400
+++ b/linux/drivers/media/dvb/frontends/tda10023.c      Fri Jun 20 00:45:55 
2008 +0200
@@ -74,9 +74,12 @@ static u8 tda10023_readreg (struct tda10
        int ret;
 
        ret = i2c_transfer (state->i2c, msg, 2);
-       if (ret != 2)
-               printk("DVB: TDA10023: %s: readreg error (ret == %i)\n",
-                                __func__, ret);
+       if (ret != 2) {
+               int num = state->frontend.dvb ? state->frontend.dvb->num : -1;
+               printk(KERN_ERR "DVB: TDA10023(%d): %s: readreg error "
+                       "(reg == 0x%02x, ret == %i)\n",
+                       num, __func__, reg, ret);
+       }
        return b1[0];
 }
 
@@ -87,11 +90,12 @@ static int tda10023_writereg (struct tda
        int ret;
 
        ret = i2c_transfer (state->i2c, &msg, 1);
-       if (ret != 1)
-               printk("DVB: TDA10023(%d): %s, writereg error "
+       if (ret != 1) {
+               int num = state->frontend.dvb ? state->frontend.dvb->num : -1;
+               printk(KERN_ERR "DVB: TDA10023(%d): %s, writereg error "
                        "(reg == 0x%02x, val == 0x%02x, ret == %i)\n",
-                       state->frontend.dvb->num, __func__, reg, data, ret);
-
+                       num, __func__, reg, data, ret);
+       }
        return (ret != 1) ? -EREMOTEIO : 0;
 }
 
@@ -485,7 +489,7 @@ struct dvb_frontend *tda10023_attach(con
        struct tda10023_state* state = NULL;
 
        /* allocate memory for the internal state */
-       state = kmalloc(sizeof(struct tda10023_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct tda10023_state), GFP_KERNEL);
        if (state == NULL) goto error;
 
        /* setup the state */


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/6fe4ffe24ba52bd532e21d45e4d5f0aa9ca91bb8

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to