]> err.no Git - linux-2.6/blobdiff - drivers/media/video/bt8xx/bt832.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[linux-2.6] / drivers / media / video / bt8xx / bt832.c
index cc54b62f4601632ae5fee015a8b760fd524a7f05..216fc9680e80c01ebd9762680403ab5b7831cbfd 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-#include <media/audiochip.h>
 #include <media/v4l2-common.h>
 
 #include "bttv.h"
@@ -39,7 +38,7 @@
 MODULE_LICENSE("GPL");
 
 /* Addresses to scan */
-static unsigned short normal_i2c[] = { I2C_BT832_ALT1>>1, I2C_BT832_ALT2>>1,
+static unsigned short normal_i2c[] = { I2C_ADDR_BT832_ALT1>>1, I2C_ADDR_BT832_ALT2>>1,
                                       I2C_CLIENT_END };
 I2C_CLIENT_INSMOD;
 
@@ -98,6 +97,11 @@ int bt832_init(struct i2c_client *i2c_client_s)
        int rc;
 
        buf=kmalloc(65,GFP_KERNEL);
+       if (!buf) {
+               v4l_err(&t->client,
+                       "Unable to allocate memory. Detaching.\n");
+               return 0;
+       }
        bt832_hexdump(i2c_client_s,buf);
 
        if(buf[0x40] != 0x31) {
@@ -175,7 +179,6 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, int kind)
 
        v4l_info(&t->client,"chip found @ 0x%x\n", addr<<1);
 
-
        if(! bt832_init(&t->client)) {
                bt832_detach(&t->client);
                return -1;
@@ -212,7 +215,12 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg)
        switch (cmd) {
                case BT832_HEXDUMP: {
                        unsigned char *buf;
-                       buf=kmalloc(65,GFP_KERNEL);
+                       buf = kmalloc(65, GFP_KERNEL);
+                       if (!buf) {
+                               v4l_err(&t->client,
+                                       "Unable to allocate memory\n");
+                               break;
+                       }
                        bt832_hexdump(&t->client,buf);
                        kfree(buf);
                }