cris: arch-v32: gpio: Use kzalloc instead of kmalloc/memset
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Fri, 1 May 2015 13:58:19 +0000 (15:58 +0200)
committerJesper Nilsson <jespern@axis.com>
Fri, 4 Sep 2015 22:33:24 +0000 (00:33 +0200)
Turn a kmalloc/memset into an equivalent kzalloc.
Doing so also move the zero'ing of the memory outside of a mutex.

Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Signed-off-by: Jesper Nilsson <jespern@axis.com>
arch/cris/arch-v32/drivers/mach-fs/gpio.c

index 009f4ee..72968fb 100644 (file)
@@ -425,12 +425,11 @@ gpio_open(struct inode *inode, struct file *filp)
        if (p > GPIO_MINOR_LAST)
                return -EINVAL;
 
-       priv = kmalloc(sizeof(struct gpio_private), GFP_KERNEL);
+       priv = kzalloc(sizeof(struct gpio_private), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;
 
        mutex_lock(&gpio_mutex);
-       memset(priv, 0, sizeof(*priv));
 
        priv->minor = p;