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

Commit 3159f06d authored by Robert P. J. Day's avatar Robert P. J. Day Committed by Linus Torvalds
Browse files

[PATCH] OSS: replace kmalloc()+memset() combos with kzalloc()



Replace kmalloc() + memset() pairs with the appropriate kzalloc() calls.

Signed-off-by: default avatarRobert P. J. Day <rpjday@mindspring.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cd354f1a
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -744,11 +744,10 @@ static int ac97_check_modem(struct ac97_codec *codec)
 
struct ac97_codec *ac97_alloc_codec(void)
{
	struct ac97_codec *codec = kmalloc(sizeof(struct ac97_codec), GFP_KERNEL);
	struct ac97_codec *codec = kzalloc(sizeof(struct ac97_codec), GFP_KERNEL);
	if(!codec)
		return NULL;

	memset(codec, 0, sizeof(*codec));
	spin_lock_init(&codec->lock);
	INIT_LIST_HEAD(&codec->list);
	return codec;
+1 −2
Original line number Diff line number Diff line
@@ -230,9 +230,8 @@ static ad1889_dev_t *ad1889_alloc_dev(struct pci_dev *pci)
	struct dmabuf *dmabuf;
	int i;

	if ((dev = kmalloc(sizeof(ad1889_dev_t), GFP_KERNEL)) == NULL) 
	if ((dev = kzalloc(sizeof(ad1889_dev_t), GFP_KERNEL)) == NULL)
		return NULL;
	memset(dev, 0, sizeof(ad1889_dev_t));
	spin_lock_init(&dev->lock);
	dev->pci = pci;

+1 −2
Original line number Diff line number Diff line
@@ -915,12 +915,11 @@ static int __devinit btaudio_probe(struct pci_dev *pci_dev,
		return -EBUSY;
	}

	bta = kmalloc(sizeof(*bta),GFP_ATOMIC);
	bta = kzalloc(sizeof(*bta),GFP_ATOMIC);
	if (!bta) {
		rc = -ENOMEM;
		goto fail0;
	}
	memset(bta,0,sizeof(*bta));

	bta->pci  = pci_dev;
	bta->irq  = pci_dev->irq;
+3 −6
Original line number Diff line number Diff line
@@ -3048,10 +3048,9 @@ static int cs_open(struct inode *inode, struct file *file)
		CS_DBGOUT(CS_WAVE_READ, 2, printk("cs46xx: cs_open() FMODE_READ\n") );
		if (card->states[0] == NULL) {
			state = card->states[0] =
				kmalloc(sizeof(struct cs_state), GFP_KERNEL);
				kzalloc(sizeof(struct cs_state), GFP_KERNEL);
			if (state == NULL)
				return -ENOMEM;
			memset(state, 0, sizeof(struct cs_state));
			mutex_init(&state->sem);
			dmabuf = &state->dmabuf;
			dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
@@ -3114,10 +3113,9 @@ static int cs_open(struct inode *inode, struct file *file)
		CS_DBGOUT(CS_OPEN, 2, printk("cs46xx: cs_open() FMODE_WRITE\n") );
		if (card->states[1] == NULL) {
			state = card->states[1] =
				kmalloc(sizeof(struct cs_state), GFP_KERNEL);
				kzalloc(sizeof(struct cs_state), GFP_KERNEL);
			if (state == NULL)
				return -ENOMEM;
			memset(state, 0, sizeof(struct cs_state));
			mutex_init(&state->sem);
			dmabuf = &state->dmabuf;
			dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
@@ -5075,11 +5073,10 @@ static int __devinit cs46xx_probe(struct pci_dev *pci_dev,
	pci_read_config_word(pci_dev, PCI_SUBSYSTEM_VENDOR_ID, &ss_vendor);
	pci_read_config_word(pci_dev, PCI_SUBSYSTEM_ID, &ss_card);

	if ((card = kmalloc(sizeof(struct cs_card), GFP_KERNEL)) == NULL) {
	if ((card = kzalloc(sizeof(struct cs_card), GFP_KERNEL)) == NULL) {
		printk(KERN_ERR "cs46xx: out of memory\n");
		return -ENOMEM;
	}
	memset(card, 0, sizeof(*card));
	card->ba0_addr = RSRCADDRESS(pci_dev, 0);
	card->ba1_addr = RSRCADDRESS(pci_dev, 1);
	card->pci_dev = pci_dev;
+1 −2
Original line number Diff line number Diff line
@@ -163,10 +163,9 @@ static int daca_detect_client(struct i2c_adapter *adapter, int address)
	struct i2c_client *new_client;
	int rc = -ENODEV;

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

	new_client->addr = address;
	new_client->adapter = adapter;
Loading