Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5263ebb5 authored by Deepak Saxena's avatar Deepak Saxena Committed by Greg Kroah-Hartman
Browse files

[PATCH] i2c: kzalloc conversion, other drivers



Use kzalloc instead of kmalloc+memset in all remaining i2c bus and
chip drivers.

Signed-off-by: default avatarDeepak Saxena <dsaxena@plexity.net>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ba9c2e8d
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -344,10 +344,9 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_
	if (~pci_resource_flags(dev, 0) & IORESOURCE_IO)
		return -ENODEV;

	smbus = kmalloc(sizeof(struct amd_smbus), GFP_KERNEL);
	smbus = kzalloc(sizeof(struct amd_smbus), GFP_KERNEL);
	if (!smbus)
		return -ENOMEM;
	memset(smbus, 0, sizeof(struct amd_smbus));

	smbus->dev = dev;
	smbus->base = pci_resource_start(dev, 0);
+1 −2
Original line number Diff line number Diff line
@@ -672,13 +672,12 @@ static int __devinit iic_probe(struct ocp_device *ocp){
		printk(KERN_WARNING"ibm-iic%d: missing additional data!\n",
			ocp->def->index);

	if (!(dev = kmalloc(sizeof(*dev), GFP_KERNEL))){
	if (!(dev = kzalloc(sizeof(*dev), GFP_KERNEL))) {
		printk(KERN_CRIT "ibm-iic%d: failed to allocate device data\n",
			ocp->def->index);
		return -ENOMEM;
	}

	memset(dev, 0, sizeof(*dev));
	dev->idx = ocp->def->index;
	ocp_set_drvdata(ocp, dev);
	
+2 −4
Original line number Diff line number Diff line
@@ -440,19 +440,17 @@ iop3xx_i2c_probe(struct device *dev)
	struct i2c_adapter *new_adapter;
	struct i2c_algo_iop3xx_data *adapter_data;

	new_adapter = kmalloc(sizeof(struct i2c_adapter), GFP_KERNEL);
	new_adapter = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL);
	if (!new_adapter) {
		ret = -ENOMEM;
		goto out;
	}
	memset((void*)new_adapter, 0, sizeof(*new_adapter));

	adapter_data = kmalloc(sizeof(struct i2c_algo_iop3xx_data), GFP_KERNEL);
	adapter_data = kzalloc(sizeof(struct i2c_algo_iop3xx_data), GFP_KERNEL);
	if (!adapter_data) {
		ret = -ENOMEM;
		goto free_adapter;
	}
	memset((void*)adapter_data, 0, sizeof(*adapter_data));

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res) {
+1 −2
Original line number Diff line number Diff line
@@ -535,13 +535,12 @@ create_iface(struct device_node *np, struct device *dev)

	tsize = sizeof(struct keywest_iface) +
		(sizeof(struct keywest_chan) + 4) * nchan;
	iface = (struct keywest_iface *) kmalloc(tsize, GFP_KERNEL);
	iface = (struct keywest_iface *) kzalloc(tsize, GFP_KERNEL);
	if (iface == NULL) {
		printk(KERN_ERR "i2c-keywest: can't allocate inteface !\n");
		pmac_low_i2c_unlock(np);
		return -ENOMEM;
	}
	memset(iface, 0, tsize);
	spin_lock_init(&iface->lock);
	init_completion(&iface->complete);
	iface->node = of_node_get(np);
+1 −2
Original line number Diff line number Diff line
@@ -296,10 +296,9 @@ static int fsl_i2c_probe(struct device *device)

	pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data;

	if (!(i2c = kmalloc(sizeof(*i2c), GFP_KERNEL))) {
	if (!(i2c = kzalloc(sizeof(*i2c), GFP_KERNEL))) {
		return -ENOMEM;
	}
	memset(i2c, 0, sizeof(*i2c));

	i2c->irq = platform_get_irq(pdev, 0);
	i2c->flags = pdata->device_flags;
Loading