Commit 57731199 authored by Michael Hunold's avatar Michael Hunold Committed by Linus Torvalds

[PATCH] Fix bugs in analog tv i2c-helper chipset drivers

 - remove cruft, memset() i2c-client structures in tda9840, tea6420,
    tea6415c driver, otherwise i2c_register()/kobject() segfaults later on
parent 7b04afe9
...@@ -196,6 +196,7 @@ static int tda9840_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -196,6 +196,7 @@ static int tda9840_detect(struct i2c_adapter *adapter, int address, int kind)
printk("tda9840.o: not enough kernel memory.\n"); printk("tda9840.o: not enough kernel memory.\n");
return -ENOMEM; return -ENOMEM;
} }
memset(client, 0, sizeof(struct i2c_client));
/* fill client structure */ /* fill client structure */
sprintf(client->name,"tda9840 (0x%02x)", address); sprintf(client->name,"tda9840 (0x%02x)", address);
...@@ -258,9 +259,7 @@ static int tda9840_detach(struct i2c_client *client) ...@@ -258,9 +259,7 @@ static int tda9840_detach(struct i2c_client *client)
} }
static struct i2c_driver driver = { static struct i2c_driver driver = {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,54)
.owner = THIS_MODULE, .owner = THIS_MODULE,
#endif
.name = "tda9840 driver", .name = "tda9840 driver",
.id = I2C_DRIVERID_TDA9840, .id = I2C_DRIVERID_TDA9840,
.flags = I2C_DF_NOTIFY, .flags = I2C_DF_NOTIFY,
......
...@@ -70,6 +70,7 @@ static int tea6415c_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -70,6 +70,7 @@ static int tea6415c_detect(struct i2c_adapter *adapter, int address, int kind)
if (0 == client) { if (0 == client) {
return -ENOMEM; return -ENOMEM;
} }
memset(client, 0, sizeof(struct i2c_client));
/* fill client structure */ /* fill client structure */
sprintf(client->name,"tea6415c (0x%02x)", address); sprintf(client->name,"tea6415c (0x%02x)", address);
...@@ -207,9 +208,7 @@ static int tea6415c_command(struct i2c_client *client, unsigned int cmd, void* a ...@@ -207,9 +208,7 @@ static int tea6415c_command(struct i2c_client *client, unsigned int cmd, void* a
} }
static struct i2c_driver driver = { static struct i2c_driver driver = {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,54)
.owner = THIS_MODULE, .owner = THIS_MODULE,
#endif
.name = "tea6415c driver", .name = "tea6415c driver",
.id = I2C_DRIVERID_TEA6415C, .id = I2C_DRIVERID_TEA6415C,
.flags = I2C_DF_NOTIFY, .flags = I2C_DF_NOTIFY,
......
...@@ -110,6 +110,7 @@ static int tea6420_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -110,6 +110,7 @@ static int tea6420_detect(struct i2c_adapter *adapter, int address, int kind)
if (0 == client) { if (0 == client) {
return -ENOMEM; return -ENOMEM;
} }
memset(client, 0x0, sizeof(struct i2c_client));
/* fill client structure */ /* fill client structure */
sprintf(client->name,"tea6420 (0x%02x)", address); sprintf(client->name,"tea6420 (0x%02x)", address);
...@@ -187,9 +188,7 @@ static int tea6420_command(struct i2c_client *client, unsigned int cmd, void* ar ...@@ -187,9 +188,7 @@ static int tea6420_command(struct i2c_client *client, unsigned int cmd, void* ar
} }
static struct i2c_driver driver = { static struct i2c_driver driver = {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,54)
.owner = THIS_MODULE, .owner = THIS_MODULE,
#endif
.name = "tea6420 driver", .name = "tea6420 driver",
.id = I2C_DRIVERID_TEA6420, .id = I2C_DRIVERID_TEA6420,
.flags = I2C_DF_NOTIFY, .flags = I2C_DF_NOTIFY,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment