diff options
-rw-r--r-- | drivers/i2c/busses/i2c-amd8111.c | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-ibm_iic.c | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-iop3xx.c | 6 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-keywest.c | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-mpc.c | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-mv64xxx.c | 5 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-nforce2.c | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-parport.c | 5 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-pmac-smu.c | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-prosavage.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/scx200_acb.c | 3 | ||||
-rw-r--r-- | drivers/i2c/chips/ds1337.c | 3 | ||||
-rw-r--r-- | drivers/i2c/chips/ds1374.c | 3 | ||||
-rw-r--r-- | drivers/i2c/chips/eeprom.c | 3 | ||||
-rw-r--r-- | drivers/i2c/chips/m41t00.c | 3 | ||||
-rw-r--r-- | drivers/i2c/chips/max6875.c | 6 | ||||
-rw-r--r-- | drivers/i2c/chips/pca9539.c | 3 | ||||
-rw-r--r-- | drivers/i2c/chips/pcf8574.c | 3 | ||||
-rw-r--r-- | drivers/i2c/chips/pcf8591.c | 3 | ||||
-rw-r--r-- | drivers/i2c/chips/rtc8564.c | 3 | ||||
-rw-r--r-- | drivers/i2c/chips/tps65010.c | 3 | ||||
-rw-r--r-- | drivers/i2c/i2c-dev.c | 3 |
22 files changed, 25 insertions, 52 deletions
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c index 0d29e78dff63..aface7938a5b 100644 --- a/drivers/i2c/busses/i2c-amd8111.c +++ b/drivers/i2c/busses/i2c-amd8111.c | |||
@@ -344,10 +344,9 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ | |||
344 | if (~pci_resource_flags(dev, 0) & IORESOURCE_IO) | 344 | if (~pci_resource_flags(dev, 0) & IORESOURCE_IO) |
345 | return -ENODEV; | 345 | return -ENODEV; |
346 | 346 | ||
347 | smbus = kmalloc(sizeof(struct amd_smbus), GFP_KERNEL); | 347 | smbus = kzalloc(sizeof(struct amd_smbus), GFP_KERNEL); |
348 | if (!smbus) | 348 | if (!smbus) |
349 | return -ENOMEM; | 349 | return -ENOMEM; |
350 | memset(smbus, 0, sizeof(struct amd_smbus)); | ||
351 | 350 | ||
352 | smbus->dev = dev; | 351 | smbus->dev = dev; |
353 | smbus->base = pci_resource_start(dev, 0); | 352 | smbus->base = pci_resource_start(dev, 0); |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index a3ed9590f028..1a587253d716 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -672,13 +672,12 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
672 | printk(KERN_WARNING"ibm-iic%d: missing additional data!\n", | 672 | printk(KERN_WARNING"ibm-iic%d: missing additional data!\n", |
673 | ocp->def->index); | 673 | ocp->def->index); |
674 | 674 | ||
675 | if (!(dev = kmalloc(sizeof(*dev), GFP_KERNEL))){ | 675 | if (!(dev = kzalloc(sizeof(*dev), GFP_KERNEL))) { |
676 | printk(KERN_CRIT "ibm-iic%d: failed to allocate device data\n", | 676 | printk(KERN_CRIT "ibm-iic%d: failed to allocate device data\n", |
677 | ocp->def->index); | 677 | ocp->def->index); |
678 | return -ENOMEM; | 678 | return -ENOMEM; |
679 | } | 679 | } |
680 | 680 | ||
681 | memset(dev, 0, sizeof(*dev)); | ||
682 | dev->idx = ocp->def->index; | 681 | dev->idx = ocp->def->index; |
683 | ocp_set_drvdata(ocp, dev); | 682 | ocp_set_drvdata(ocp, dev); |
684 | 683 | ||
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c index 0f7dfd8f4546..9888fae1f37a 100644 --- a/drivers/i2c/busses/i2c-iop3xx.c +++ b/drivers/i2c/busses/i2c-iop3xx.c | |||
@@ -440,19 +440,17 @@ iop3xx_i2c_probe(struct device *dev) | |||
440 | struct i2c_adapter *new_adapter; | 440 | struct i2c_adapter *new_adapter; |
441 | struct i2c_algo_iop3xx_data *adapter_data; | 441 | struct i2c_algo_iop3xx_data *adapter_data; |
442 | 442 | ||
443 | new_adapter = kmalloc(sizeof(struct i2c_adapter), GFP_KERNEL); | 443 | new_adapter = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL); |
444 | if (!new_adapter) { | 444 | if (!new_adapter) { |
445 | ret = -ENOMEM; | 445 | ret = -ENOMEM; |
446 | goto out; | 446 | goto out; |
447 | } | 447 | } |
448 | memset((void*)new_adapter, 0, sizeof(*new_adapter)); | ||
449 | 448 | ||
450 | adapter_data = kmalloc(sizeof(struct i2c_algo_iop3xx_data), GFP_KERNEL); | 449 | adapter_data = kzalloc(sizeof(struct i2c_algo_iop3xx_data), GFP_KERNEL); |
451 | if (!adapter_data) { | 450 | if (!adapter_data) { |
452 | ret = -ENOMEM; | 451 | ret = -ENOMEM; |
453 | goto free_adapter; | 452 | goto free_adapter; |
454 | } | 453 | } |
455 | memset((void*)adapter_data, 0, sizeof(*adapter_data)); | ||
456 | 454 | ||
457 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 455 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
458 | if (!res) { | 456 | if (!res) { |
diff --git a/drivers/i2c/busses/i2c-keywest.c b/drivers/i2c/busses/i2c-keywest.c index 34e43c8d8d5e..ef281e0c567b 100644 --- a/drivers/i2c/busses/i2c-keywest.c +++ b/drivers/i2c/busses/i2c-keywest.c | |||
@@ -535,13 +535,12 @@ create_iface(struct device_node *np, struct device *dev) | |||
535 | 535 | ||
536 | tsize = sizeof(struct keywest_iface) + | 536 | tsize = sizeof(struct keywest_iface) + |
537 | (sizeof(struct keywest_chan) + 4) * nchan; | 537 | (sizeof(struct keywest_chan) + 4) * nchan; |
538 | iface = (struct keywest_iface *) kmalloc(tsize, GFP_KERNEL); | 538 | iface = (struct keywest_iface *) kzalloc(tsize, GFP_KERNEL); |
539 | if (iface == NULL) { | 539 | if (iface == NULL) { |
540 | printk(KERN_ERR "i2c-keywest: can't allocate inteface !\n"); | 540 | printk(KERN_ERR "i2c-keywest: can't allocate inteface !\n"); |
541 | pmac_low_i2c_unlock(np); | 541 | pmac_low_i2c_unlock(np); |
542 | return -ENOMEM; | 542 | return -ENOMEM; |
543 | } | 543 | } |
544 | memset(iface, 0, tsize); | ||
545 | spin_lock_init(&iface->lock); | 544 | spin_lock_init(&iface->lock); |
546 | init_completion(&iface->complete); | 545 | init_completion(&iface->complete); |
547 | iface->node = of_node_get(np); | 546 | iface->node = of_node_get(np); |
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index b81c54620030..8491633005b8 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -296,10 +296,9 @@ static int fsl_i2c_probe(struct device *device) | |||
296 | 296 | ||
297 | pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data; | 297 | pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data; |
298 | 298 | ||
299 | if (!(i2c = kmalloc(sizeof(*i2c), GFP_KERNEL))) { | 299 | if (!(i2c = kzalloc(sizeof(*i2c), GFP_KERNEL))) { |
300 | return -ENOMEM; | 300 | return -ENOMEM; |
301 | } | 301 | } |
302 | memset(i2c, 0, sizeof(*i2c)); | ||
303 | 302 | ||
304 | i2c->irq = platform_get_irq(pdev, 0); | 303 | i2c->irq = platform_get_irq(pdev, 0); |
305 | i2c->flags = pdata->device_flags; | 304 | i2c->flags = pdata->device_flags; |
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 69709ee0b896..d0d2a6f1386e 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -500,13 +500,10 @@ mv64xxx_i2c_probe(struct device *dev) | |||
500 | if ((pd->id != 0) || !pdata) | 500 | if ((pd->id != 0) || !pdata) |
501 | return -ENODEV; | 501 | return -ENODEV; |
502 | 502 | ||
503 | drv_data = kmalloc(sizeof(struct mv64xxx_i2c_data), GFP_KERNEL); | 503 | drv_data = kzalloc(sizeof(struct mv64xxx_i2c_data), GFP_KERNEL); |
504 | |||
505 | if (!drv_data) | 504 | if (!drv_data) |
506 | return -ENOMEM; | 505 | return -ENOMEM; |
507 | 506 | ||
508 | memset(drv_data, 0, sizeof(struct mv64xxx_i2c_data)); | ||
509 | |||
510 | if (mv64xxx_i2c_map_regs(pd, drv_data)) { | 507 | if (mv64xxx_i2c_map_regs(pd, drv_data)) { |
511 | rc = -ENODEV; | 508 | rc = -ENODEV; |
512 | goto exit_kfree; | 509 | goto exit_kfree; |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index 5dc62114cc8d..87b6e26aa8a0 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -313,10 +313,9 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_ | |||
313 | int res1, res2; | 313 | int res1, res2; |
314 | 314 | ||
315 | /* we support 2 SMBus adapters */ | 315 | /* we support 2 SMBus adapters */ |
316 | if (!(smbuses = (void *)kmalloc(2*sizeof(struct nforce2_smbus), | 316 | if (!(smbuses = (void *)kzalloc(2*sizeof(struct nforce2_smbus), |
317 | GFP_KERNEL))) | 317 | GFP_KERNEL))) |
318 | return -ENOMEM; | 318 | return -ENOMEM; |
319 | memset (smbuses, 0, 2*sizeof(struct nforce2_smbus)); | ||
320 | pci_set_drvdata(dev, smbuses); | 319 | pci_set_drvdata(dev, smbuses); |
321 | 320 | ||
322 | /* SMBus adapter 1 */ | 321 | /* SMBus adapter 1 */ |
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index fa506187fbe1..2854d858fc9b 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c | |||
@@ -155,12 +155,11 @@ static void i2c_parport_attach (struct parport *port) | |||
155 | { | 155 | { |
156 | struct i2c_par *adapter; | 156 | struct i2c_par *adapter; |
157 | 157 | ||
158 | adapter = kmalloc(sizeof(struct i2c_par), GFP_KERNEL); | 158 | adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL); |
159 | if (adapter == NULL) { | 159 | if (adapter == NULL) { |
160 | printk(KERN_ERR "i2c-parport: Failed to kmalloc\n"); | 160 | printk(KERN_ERR "i2c-parport: Failed to kzalloc\n"); |
161 | return; | 161 | return; |
162 | } | 162 | } |
163 | memset(adapter, 0x00, sizeof(struct i2c_par)); | ||
164 | 163 | ||
165 | pr_debug("i2c-parport: attaching to %s\n", port->name); | 164 | pr_debug("i2c-parport: attaching to %s\n", port->name); |
166 | adapter->pdev = parport_register_device(port, "i2c-parport", | 165 | adapter->pdev = parport_register_device(port, "i2c-parport", |
diff --git a/drivers/i2c/busses/i2c-pmac-smu.c b/drivers/i2c/busses/i2c-pmac-smu.c index 8a9f5648a23d..bfefe7f7a53d 100644 --- a/drivers/i2c/busses/i2c-pmac-smu.c +++ b/drivers/i2c/busses/i2c-pmac-smu.c | |||
@@ -211,12 +211,11 @@ static int create_iface(struct device_node *np, struct device *dev) | |||
211 | } | 211 | } |
212 | busid = *reg; | 212 | busid = *reg; |
213 | 213 | ||
214 | iface = kmalloc(sizeof(struct smu_iface), GFP_KERNEL); | 214 | iface = kzalloc(sizeof(struct smu_iface), GFP_KERNEL); |
215 | if (iface == NULL) { | 215 | if (iface == NULL) { |
216 | printk(KERN_ERR "i2c-pmac-smu: can't allocate inteface !\n"); | 216 | printk(KERN_ERR "i2c-pmac-smu: can't allocate inteface !\n"); |
217 | return -ENOMEM; | 217 | return -ENOMEM; |
218 | } | 218 | } |
219 | memset(iface, 0, sizeof(struct smu_iface)); | ||
220 | init_completion(&iface->complete); | 219 | init_completion(&iface->complete); |
221 | iface->busid = busid; | 220 | iface->busid = busid; |
222 | 221 | ||
diff --git a/drivers/i2c/busses/i2c-prosavage.c b/drivers/i2c/busses/i2c-prosavage.c index 92b744273577..42f8b5ce3bf8 100644 --- a/drivers/i2c/busses/i2c-prosavage.c +++ b/drivers/i2c/busses/i2c-prosavage.c | |||
@@ -241,14 +241,12 @@ static int __devinit prosavage_probe(struct pci_dev *dev, const struct pci_devic | |||
241 | struct s_i2c_chip *chip; | 241 | struct s_i2c_chip *chip; |
242 | struct s_i2c_bus *bus; | 242 | struct s_i2c_bus *bus; |
243 | 243 | ||
244 | pci_set_drvdata(dev, kmalloc(sizeof(struct s_i2c_chip), GFP_KERNEL)); | 244 | pci_set_drvdata(dev, kzalloc(sizeof(struct s_i2c_chip), GFP_KERNEL)); |
245 | chip = (struct s_i2c_chip *)pci_get_drvdata(dev); | 245 | chip = (struct s_i2c_chip *)pci_get_drvdata(dev); |
246 | if (chip == NULL) { | 246 | if (chip == NULL) { |
247 | return -ENOMEM; | 247 | return -ENOMEM; |
248 | } | 248 | } |
249 | 249 | ||
250 | memset(chip, 0, sizeof(struct s_i2c_chip)); | ||
251 | |||
252 | base = dev->resource[0].start & PCI_BASE_ADDRESS_MEM_MASK; | 250 | base = dev->resource[0].start & PCI_BASE_ADDRESS_MEM_MASK; |
253 | len = dev->resource[0].end - base + 1; | 251 | len = dev->resource[0].end - base + 1; |
254 | chip->mmio = ioremap_nocache(base, len); | 252 | chip->mmio = ioremap_nocache(base, len); |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index a1d580e05361..d3478e084522 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -442,14 +442,13 @@ static int __init scx200_acb_create(int base, int index) | |||
442 | int rc = 0; | 442 | int rc = 0; |
443 | char description[64]; | 443 | char description[64]; |
444 | 444 | ||
445 | iface = kmalloc(sizeof(*iface), GFP_KERNEL); | 445 | iface = kzalloc(sizeof(*iface), GFP_KERNEL); |
446 | if (!iface) { | 446 | if (!iface) { |
447 | printk(KERN_ERR NAME ": can't allocate memory\n"); | 447 | printk(KERN_ERR NAME ": can't allocate memory\n"); |
448 | rc = -ENOMEM; | 448 | rc = -ENOMEM; |
449 | goto errout; | 449 | goto errout; |
450 | } | 450 | } |
451 | 451 | ||
452 | memset(iface, 0, sizeof(*iface)); | ||
453 | adapter = &iface->adapter; | 452 | adapter = &iface->adapter; |
454 | i2c_set_adapdata(adapter, iface); | 453 | i2c_set_adapdata(adapter, iface); |
455 | snprintf(adapter->name, I2C_NAME_SIZE, "SCx200 ACB%d", index); | 454 | snprintf(adapter->name, I2C_NAME_SIZE, "SCx200 ACB%d", index); |
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c index 9d3175c03395..01b037007410 100644 --- a/drivers/i2c/chips/ds1337.c +++ b/drivers/i2c/chips/ds1337.c | |||
@@ -243,11 +243,10 @@ static int ds1337_detect(struct i2c_adapter *adapter, int address, int kind) | |||
243 | I2C_FUNC_I2C)) | 243 | I2C_FUNC_I2C)) |
244 | goto exit; | 244 | goto exit; |
245 | 245 | ||
246 | if (!(data = kmalloc(sizeof(struct ds1337_data), GFP_KERNEL))) { | 246 | if (!(data = kzalloc(sizeof(struct ds1337_data), GFP_KERNEL))) { |
247 | err = -ENOMEM; | 247 | err = -ENOMEM; |
248 | goto exit; | 248 | goto exit; |
249 | } | 249 | } |
250 | memset(data, 0, sizeof(struct ds1337_data)); | ||
251 | INIT_LIST_HEAD(&data->list); | 250 | INIT_LIST_HEAD(&data->list); |
252 | 251 | ||
253 | /* The common I2C client data is placed right before the | 252 | /* The common I2C client data is placed right before the |
diff --git a/drivers/i2c/chips/ds1374.c b/drivers/i2c/chips/ds1374.c index ec640e9f085a..1596e6478782 100644 --- a/drivers/i2c/chips/ds1374.c +++ b/drivers/i2c/chips/ds1374.c | |||
@@ -193,11 +193,10 @@ static int ds1374_probe(struct i2c_adapter *adap, int addr, int kind) | |||
193 | struct i2c_client *client; | 193 | struct i2c_client *client; |
194 | int rc; | 194 | int rc; |
195 | 195 | ||
196 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 196 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
197 | if (!client) | 197 | if (!client) |
198 | return -ENOMEM; | 198 | return -ENOMEM; |
199 | 199 | ||
200 | memset(client, 0, sizeof(struct i2c_client)); | ||
201 | strncpy(client->name, DS1374_DRV_NAME, I2C_NAME_SIZE); | 200 | strncpy(client->name, DS1374_DRV_NAME, I2C_NAME_SIZE); |
202 | client->addr = addr; | 201 | client->addr = addr; |
203 | client->adapter = adap; | 202 | client->adapter = adap; |
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index 7fb739c43935..ee7cbc823fd1 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c | |||
@@ -171,11 +171,10 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) | |||
171 | | I2C_FUNC_SMBUS_BYTE)) | 171 | | I2C_FUNC_SMBUS_BYTE)) |
172 | goto exit; | 172 | goto exit; |
173 | 173 | ||
174 | if (!(data = kmalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { | 174 | if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { |
175 | err = -ENOMEM; | 175 | err = -ENOMEM; |
176 | goto exit; | 176 | goto exit; |
177 | } | 177 | } |
178 | memset(data, 0, sizeof(struct eeprom_data)); | ||
179 | 178 | ||
180 | new_client = &data->client; | 179 | new_client = &data->client; |
181 | memset(data->data, 0xff, EEPROM_SIZE); | 180 | memset(data->data, 0xff, EEPROM_SIZE); |
diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c index 554f7ba61627..3df309ae44a6 100644 --- a/drivers/i2c/chips/m41t00.c +++ b/drivers/i2c/chips/m41t00.c | |||
@@ -174,11 +174,10 @@ m41t00_probe(struct i2c_adapter *adap, int addr, int kind) | |||
174 | struct i2c_client *client; | 174 | struct i2c_client *client; |
175 | int rc; | 175 | int rc; |
176 | 176 | ||
177 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 177 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
178 | if (!client) | 178 | if (!client) |
179 | return -ENOMEM; | 179 | return -ENOMEM; |
180 | 180 | ||
181 | memset(client, 0, sizeof(struct i2c_client)); | ||
182 | strncpy(client->name, M41T00_DRV_NAME, I2C_NAME_SIZE); | 181 | strncpy(client->name, M41T00_DRV_NAME, I2C_NAME_SIZE); |
183 | client->addr = addr; | 182 | client->addr = addr; |
184 | client->adapter = adap; | 183 | client->adapter = adap; |
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index 9e1aeb69abf9..b376a006883c 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c | |||
@@ -179,16 +179,14 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind) | |||
179 | if (address & 1) | 179 | if (address & 1) |
180 | return 0; | 180 | return 0; |
181 | 181 | ||
182 | if (!(data = kmalloc(sizeof(struct max6875_data), GFP_KERNEL))) | 182 | if (!(data = kzalloc(sizeof(struct max6875_data), GFP_KERNEL))) |
183 | return -ENOMEM; | 183 | return -ENOMEM; |
184 | memset(data, 0, sizeof(struct max6875_data)); | ||
185 | 184 | ||
186 | /* A fake client is created on the odd address */ | 185 | /* A fake client is created on the odd address */ |
187 | if (!(fake_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL))) { | 186 | if (!(fake_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL))) { |
188 | err = -ENOMEM; | 187 | err = -ENOMEM; |
189 | goto exit_kfree1; | 188 | goto exit_kfree1; |
190 | } | 189 | } |
191 | memset(fake_client, 0, sizeof(struct i2c_client)); | ||
192 | 190 | ||
193 | /* Init real i2c_client */ | 191 | /* Init real i2c_client */ |
194 | real_client = &data->client; | 192 | real_client = &data->client; |
diff --git a/drivers/i2c/chips/pca9539.c b/drivers/i2c/chips/pca9539.c index 225577fdda4d..59a930346229 100644 --- a/drivers/i2c/chips/pca9539.c +++ b/drivers/i2c/chips/pca9539.c | |||
@@ -122,11 +122,10 @@ static int pca9539_detect(struct i2c_adapter *adapter, int address, int kind) | |||
122 | 122 | ||
123 | /* OK. For now, we presume we have a valid client. We now create the | 123 | /* OK. For now, we presume we have a valid client. We now create the |
124 | client structure, even though we cannot fill it completely yet. */ | 124 | client structure, even though we cannot fill it completely yet. */ |
125 | if (!(data = kmalloc(sizeof(struct pca9539_data), GFP_KERNEL))) { | 125 | if (!(data = kzalloc(sizeof(struct pca9539_data), GFP_KERNEL))) { |
126 | err = -ENOMEM; | 126 | err = -ENOMEM; |
127 | goto exit; | 127 | goto exit; |
128 | } | 128 | } |
129 | memset(data, 0, sizeof(struct pca9539_data)); | ||
130 | 129 | ||
131 | new_client = &data->client; | 130 | new_client = &data->client; |
132 | i2c_set_clientdata(new_client, data); | 131 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/i2c/chips/pcf8574.c b/drivers/i2c/chips/pcf8574.c index 6525743ff9fd..2c2555d46fdf 100644 --- a/drivers/i2c/chips/pcf8574.c +++ b/drivers/i2c/chips/pcf8574.c | |||
@@ -127,11 +127,10 @@ int pcf8574_detect(struct i2c_adapter *adapter, int address, int kind) | |||
127 | 127 | ||
128 | /* OK. For now, we presume we have a valid client. We now create the | 128 | /* OK. For now, we presume we have a valid client. We now create the |
129 | client structure, even though we cannot fill it completely yet. */ | 129 | client structure, even though we cannot fill it completely yet. */ |
130 | if (!(data = kmalloc(sizeof(struct pcf8574_data), GFP_KERNEL))) { | 130 | if (!(data = kzalloc(sizeof(struct pcf8574_data), GFP_KERNEL))) { |
131 | err = -ENOMEM; | 131 | err = -ENOMEM; |
132 | goto exit; | 132 | goto exit; |
133 | } | 133 | } |
134 | memset(data, 0, sizeof(struct pcf8574_data)); | ||
135 | 134 | ||
136 | new_client = &data->client; | 135 | new_client = &data->client; |
137 | i2c_set_clientdata(new_client, data); | 136 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/i2c/chips/pcf8591.c b/drivers/i2c/chips/pcf8591.c index 80f1df9a4500..3c815b153249 100644 --- a/drivers/i2c/chips/pcf8591.c +++ b/drivers/i2c/chips/pcf8591.c | |||
@@ -178,11 +178,10 @@ int pcf8591_detect(struct i2c_adapter *adapter, int address, int kind) | |||
178 | 178 | ||
179 | /* OK. For now, we presume we have a valid client. We now create the | 179 | /* OK. For now, we presume we have a valid client. We now create the |
180 | client structure, even though we cannot fill it completely yet. */ | 180 | client structure, even though we cannot fill it completely yet. */ |
181 | if (!(data = kmalloc(sizeof(struct pcf8591_data), GFP_KERNEL))) { | 181 | if (!(data = kzalloc(sizeof(struct pcf8591_data), GFP_KERNEL))) { |
182 | err = -ENOMEM; | 182 | err = -ENOMEM; |
183 | goto exit; | 183 | goto exit; |
184 | } | 184 | } |
185 | memset(data, 0, sizeof(struct pcf8591_data)); | ||
186 | 185 | ||
187 | new_client = &data->client; | 186 | new_client = &data->client; |
188 | i2c_set_clientdata(new_client, data); | 187 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c index dd9d42d7b6e7..916cdc1af23c 100644 --- a/drivers/i2c/chips/rtc8564.c +++ b/drivers/i2c/chips/rtc8564.c | |||
@@ -148,12 +148,11 @@ static int rtc8564_attach(struct i2c_adapter *adap, int addr, int kind) | |||
148 | {addr, I2C_M_RD, 2, data} | 148 | {addr, I2C_M_RD, 2, data} |
149 | }; | 149 | }; |
150 | 150 | ||
151 | d = kmalloc(sizeof(struct rtc8564_data), GFP_KERNEL); | 151 | d = kzalloc(sizeof(struct rtc8564_data), GFP_KERNEL); |
152 | if (!d) { | 152 | if (!d) { |
153 | ret = -ENOMEM; | 153 | ret = -ENOMEM; |
154 | goto done; | 154 | goto done; |
155 | } | 155 | } |
156 | memset(d, 0, sizeof(struct rtc8564_data)); | ||
157 | new_client = &d->client; | 156 | new_client = &d->client; |
158 | 157 | ||
159 | strlcpy(new_client->name, "RTC8564", I2C_NAME_SIZE); | 158 | strlcpy(new_client->name, "RTC8564", I2C_NAME_SIZE); |
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index 280e9638c0f8..280dd7a45db6 100644 --- a/drivers/i2c/chips/tps65010.c +++ b/drivers/i2c/chips/tps65010.c | |||
@@ -500,11 +500,10 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind) | |||
500 | return 0; | 500 | return 0; |
501 | } | 501 | } |
502 | 502 | ||
503 | tps = kmalloc(sizeof *tps, GFP_KERNEL); | 503 | tps = kzalloc(sizeof *tps, GFP_KERNEL); |
504 | if (!tps) | 504 | if (!tps) |
505 | return 0; | 505 | return 0; |
506 | 506 | ||
507 | memset(tps, 0, sizeof *tps); | ||
508 | init_MUTEX(&tps->lock); | 507 | init_MUTEX(&tps->lock); |
509 | INIT_WORK(&tps->work, tps65010_work, tps); | 508 | INIT_WORK(&tps->work, tps65010_work, tps); |
510 | tps->irq = -1; | 509 | tps->irq = -1; |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 89f54a5e8484..276ec42a0717 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
@@ -80,10 +80,9 @@ static struct i2c_dev *get_free_i2c_dev(struct i2c_adapter *adap) | |||
80 | { | 80 | { |
81 | struct i2c_dev *i2c_dev; | 81 | struct i2c_dev *i2c_dev; |
82 | 82 | ||
83 | i2c_dev = kmalloc(sizeof(*i2c_dev), GFP_KERNEL); | 83 | i2c_dev = kzalloc(sizeof(*i2c_dev), GFP_KERNEL); |
84 | if (!i2c_dev) | 84 | if (!i2c_dev) |
85 | return ERR_PTR(-ENOMEM); | 85 | return ERR_PTR(-ENOMEM); |
86 | memset(i2c_dev, 0x00, sizeof(*i2c_dev)); | ||
87 | 86 | ||
88 | spin_lock(&i2c_dev_array_lock); | 87 | spin_lock(&i2c_dev_array_lock); |
89 | if (i2c_dev_array[adap->nr]) { | 88 | if (i2c_dev_array[adap->nr]) { |