The patch number 11568 was added via Mauro Carvalho Chehab <mche...@redhat.com>
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:
        Linux Media Mailing List <linux-me...@vger.kernel.org>

------

From: Jean Delvare  <kh...@linux-fr.org>
cx18: Fix the handling of i2c bus registration error


* Return actual error values as returned by the i2c subsystem, rather
  than 0 or 1.
* If the registration of the second bus fails, unregister the first one
  before exiting, otherwise we are leaking resources.

Signed-off-by: Jean Delvare <kh...@linux-fr.org>
Acked-by: Andy Walls <awa...@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com>


---

 linux/drivers/media/video/cx18/cx18-i2c.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff -r b550f85165d7 -r 56e62dbe0b10 linux/drivers/media/video/cx18/cx18-i2c.c
--- a/linux/drivers/media/video/cx18/cx18-i2c.c Tue Apr 14 18:47:17 2009 +0000
+++ b/linux/drivers/media/video/cx18/cx18-i2c.c Fri Apr 17 13:56:51 2009 +0000
@@ -214,7 +214,7 @@ static struct i2c_algo_bit_data cx18_i2c
 /* init + register i2c algo-bit adapter */
 int init_cx18_i2c(struct cx18 *cx)
 {
-       int i;
+       int i, err;
        CX18_DEBUG_I2C("i2c init\n");
 
        for (i = 0; i < 2; i++) {
@@ -273,8 +273,18 @@ int init_cx18_i2c(struct cx18 *cx)
        cx18_call_hw(cx, CX18_HW_GPIO_RESET_CTRL,
                     core, reset, (u32) CX18_GPIO_RESET_I2C);
 
-       return i2c_bit_add_bus(&cx->i2c_adap[0]) ||
-               i2c_bit_add_bus(&cx->i2c_adap[1]);
+       err = i2c_bit_add_bus(&cx->i2c_adap[0]);
+       if (err)
+               goto err;
+       err = i2c_bit_add_bus(&cx->i2c_adap[1]);
+       if (err)
+               goto err_del_bus_0;
+       return 0;
+
+ err_del_bus_0:
+       i2c_del_adapter(&cx->i2c_adap[0]);
+ err:
+       return err;
 }
 
 void exit_cx18_i2c(struct cx18 *cx)


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/56e62dbe0b1027ea2c63ba426fefa9191b20adc9

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

Reply via email to