V4L/DVB (9297): cx18: Fix memory leak on card initialization failure
[safe/jmp/linux-2.6] / drivers / media / video / sn9c102 / sn9c102_pas202bcb.c
index c1b8d6b..2782f94 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <linux/delay.h>
 #include "sn9c102_sensor.h"
+#include "sn9c102_devtable.h"
 
 
 static int pas202bcb_init(struct sn9c102_device* cam)
@@ -35,29 +36,28 @@ static int pas202bcb_init(struct sn9c102_device* cam)
        switch (sn9c102_get_bridge(cam)) {
        case BRIDGE_SN9C101:
        case BRIDGE_SN9C102:
-               err = sn9c102_write_const_regs(cam, {0x00, 0x10},
-                                              {0x00, 0x11}, {0x00, 0x14},
-                                              {0x20, 0x17}, {0x30, 0x19},
-                                              {0x09, 0x18});
+               err = sn9c102_write_const_regs(cam, {0x00, 0x10}, {0x00, 0x11},
+                                              {0x00, 0x14}, {0x20, 0x17},
+                                              {0x30, 0x19}, {0x09, 0x18});
                break;
        case BRIDGE_SN9C103:
-               err = sn9c102_write_const_regs(cam, {0x00, 0x02},
-                                              {0x00, 0x03}, {0x1a, 0x04},
-                                              {0x20, 0x05}, {0x20, 0x06},
-                                              {0x20, 0x07}, {0x00, 0x10},
-                                              {0x00, 0x11}, {0x00, 0x14},
-                                              {0x20, 0x17}, {0x30, 0x19},
-                                              {0x09, 0x18}, {0x02, 0x1c},
-                                              {0x03, 0x1d}, {0x0f, 0x1e},
-                                              {0x0c, 0x1f}, {0x00, 0x20},
-                                              {0x10, 0x21}, {0x20, 0x22},
-                                              {0x30, 0x23}, {0x40, 0x24},
-                                              {0x50, 0x25}, {0x60, 0x26},
-                                              {0x70, 0x27}, {0x80, 0x28},
-                                              {0x90, 0x29}, {0xa0, 0x2a},
-                                              {0xb0, 0x2b}, {0xc0, 0x2c},
-                                              {0xd0, 0x2d}, {0xe0, 0x2e},
-                                              {0xf0, 0x2f}, {0xff, 0x30});
+               err = sn9c102_write_const_regs(cam, {0x00, 0x02}, {0x00, 0x03},
+                                              {0x1a, 0x04}, {0x20, 0x05},
+                                              {0x20, 0x06}, {0x20, 0x07},
+                                              {0x00, 0x10}, {0x00, 0x11},
+                                              {0x00, 0x14}, {0x20, 0x17},
+                                              {0x30, 0x19}, {0x09, 0x18},
+                                              {0x02, 0x1c}, {0x03, 0x1d},
+                                              {0x0f, 0x1e}, {0x0c, 0x1f},
+                                              {0x00, 0x20}, {0x10, 0x21},
+                                              {0x20, 0x22}, {0x30, 0x23},
+                                              {0x40, 0x24}, {0x50, 0x25},
+                                              {0x60, 0x26}, {0x70, 0x27},
+                                              {0x80, 0x28}, {0x90, 0x29},
+                                              {0xa0, 0x2a}, {0xb0, 0x2b},
+                                              {0xc0, 0x2c}, {0xd0, 0x2d},
+                                              {0xe0, 0x2e}, {0xf0, 0x2f},
+                                              {0xff, 0x30});
                break;
        default:
                break;
@@ -197,7 +197,7 @@ static int pas202bcb_set_crop(struct sn9c102_device* cam,
 }
 
 
-static struct sn9c102_sensor pas202bcb = {
+static const struct sn9c102_sensor pas202bcb = {
        .name = "PAS202BCB",
        .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>",
        .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102 | BRIDGE_SN9C103,
@@ -313,9 +313,8 @@ int sn9c102_probe_pas202bcb(struct sn9c102_device* cam)
                                               {0x28, 0x17});/* clock 24 MHz */
                break;
        case BRIDGE_SN9C103: /* do _not_ change anything! */
-               err = sn9c102_write_const_regs(cam, {0x09, 0x01},
-                                              {0x44, 0x01}, {0x44, 0x02},
-                                              {0x29, 0x17});
+               err = sn9c102_write_const_regs(cam, {0x09, 0x01}, {0x44, 0x01},
+                                              {0x44, 0x02}, {0x29, 0x17});
                break;
        default:
                break;