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

Commit d2a02b93 authored by Russell King's avatar Russell King Committed by Russell King
Browse files

[ARM] Convert kmalloc+memset to kzalloc



Convert all uses of kmalloc followed by memset to use kzalloc instead.

Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 18ec5c73
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -501,12 +501,11 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
	struct locomo_dev *dev;
	int ret;

	dev = kmalloc(sizeof(struct locomo_dev), GFP_KERNEL);
	dev = kzalloc(sizeof(struct locomo_dev), GFP_KERNEL);
	if (!dev) {
		ret = -ENOMEM;
		goto out;
	}
	memset(dev, 0, sizeof(struct locomo_dev));

	strncpy(dev->dev.bus_id,info->name,sizeof(dev->dev.bus_id));
	/*
@@ -664,12 +663,10 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
	unsigned long r;
	int i, ret = -ENODEV;

	lchip = kmalloc(sizeof(struct locomo), GFP_KERNEL);
	lchip = kzalloc(sizeof(struct locomo), GFP_KERNEL);
	if (!lchip)
		return -ENOMEM;

	memset(lchip, 0, sizeof(struct locomo));

	spin_lock_init(&lchip->lock);

	lchip->dev = me;
+2 −5
Original line number Diff line number Diff line
@@ -541,12 +541,11 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent,
	struct sa1111_dev *dev;
	int ret;

	dev = kmalloc(sizeof(struct sa1111_dev), GFP_KERNEL);
	dev = kzalloc(sizeof(struct sa1111_dev), GFP_KERNEL);
	if (!dev) {
		ret = -ENOMEM;
		goto out;
	}
	memset(dev, 0, sizeof(struct sa1111_dev));

	snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id),
		 "%4.4lx", info->offset);
@@ -621,12 +620,10 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
	unsigned int has_devs, val;
	int i, ret = -ENODEV;

	sachip = kmalloc(sizeof(struct sa1111), GFP_KERNEL);
	sachip = kzalloc(sizeof(struct sa1111), GFP_KERNEL);
	if (!sachip)
		return -ENOMEM;

	memset(sachip, 0, sizeof(struct sa1111));

	sachip->clk = clk_get(me, "GPIO27_CLK");
	if (!sachip->clk) {
		ret = PTR_ERR(sachip->clk);
+2 −4
Original line number Diff line number Diff line
@@ -132,12 +132,10 @@ int __init scoop_probe(struct platform_device *pdev)
	if (!mem)
		return -EINVAL;

	devptr = kmalloc(sizeof(struct scoop_dev), GFP_KERNEL);

	devptr = kzalloc(sizeof(struct scoop_dev), GFP_KERNEL);
	if (!devptr)
		return -ENOMEM;

	memset(devptr, 0, sizeof(struct scoop_dev));
	spin_lock_init(&devptr->scoop_lock);

	inf = pdev->dev.platform_data;
+1 −3
Original line number Diff line number Diff line
@@ -357,10 +357,8 @@ static int apm_open(struct inode * inode, struct file * filp)
{
	struct apm_user *as;

	as = (struct apm_user *)kmalloc(sizeof(*as), GFP_KERNEL);
	as = (struct apm_user *)kzalloc(sizeof(*as), GFP_KERNEL);
	if (as) {
		memset(as, 0, sizeof(*as));

		/*
		 * XXX - this is a tiny bit broken, when we consider BSD
		 * process accounting. If the device is opened by root, we
+1 −3
Original line number Diff line number Diff line
@@ -540,12 +540,10 @@ static void __init pcibios_init_hw(struct hw_pci *hw)
	int nr, busnr;

	for (nr = busnr = 0; nr < hw->nr_controllers; nr++) {
		sys = kmalloc(sizeof(struct pci_sys_data), GFP_KERNEL);
		sys = kzalloc(sizeof(struct pci_sys_data), GFP_KERNEL);
		if (!sys)
			panic("PCI: unable to allocate sys data!");

		memset(sys, 0, sizeof(struct pci_sys_data));

		sys->hw      = hw;
		sys->busnr   = busnr;
		sys->swizzle = hw->swizzle;
Loading