diff options
-rw-r--r-- | linux/drivers/media/video/v4l2-common.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c index f97d14486..a1d751c8a 100644 --- a/linux/drivers/media/video/v4l2-common.c +++ b/linux/drivers/media/video/v4l2-common.c @@ -1640,10 +1640,10 @@ int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver client->addr = address; client->adapter = adapter; client->driver = driver; -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) client->flags = I2C_CLIENT_ALLOW_USE; #endif - snprintf(client->name, sizeof(client->name) - 1, name); + strlcpy(client->name, name, sizeof(client->name)); err = probe(client); if (err == 0) { @@ -1651,8 +1651,7 @@ int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) MOD_INC_USE_COUNT; #endif - } - else { + } else { kfree(client); } return err != -ENOMEM ? 0 : err; |