Skip to content

Commit

Permalink
staging: rts_pstor: optimize kmalloc to kzalloc
Browse files Browse the repository at this point in the history
Use kzalloc rather than kmalloc followed by memset with 0.
Found by coccinelle.

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alexander Beregalov authored and Greg Kroah-Hartman committed Mar 9, 2011
1 parent 12d0eb4 commit 1840c15
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/staging/rts_pstor/rtsx.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,11 +931,10 @@ static int __devinit rtsx_probe(struct pci_dev *pci, const struct pci_device_id
dev = host_to_rtsx(host);
memset(dev, 0, sizeof(struct rtsx_dev));

dev->chip = (struct rtsx_chip *)kmalloc(sizeof(struct rtsx_chip), GFP_KERNEL);
dev->chip = kzalloc(sizeof(struct rtsx_chip), GFP_KERNEL);
if (dev->chip == NULL) {
goto errout;
}
memset(dev->chip, 0, sizeof(struct rtsx_chip));

spin_lock_init(&dev->reg_lock);
mutex_init(&(dev->dev_mutex));
Expand Down

0 comments on commit 1840c15

Please sign in to comment.