Commit 6a4756f6 authored by Christophe Jaillet's avatar Christophe Jaillet Committed by Jesper Nilsson

cris: arch-v32: gpio: Use kzalloc instead of kmalloc/memset

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: default avatarChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarJesper Nilsson <jespern@axis.com>
parent 51e771c0
...@@ -425,12 +425,11 @@ gpio_open(struct inode *inode, struct file *filp) ...@@ -425,12 +425,11 @@ gpio_open(struct inode *inode, struct file *filp)
if (p > GPIO_MINOR_LAST) if (p > GPIO_MINOR_LAST)
return -EINVAL; return -EINVAL;
priv = kmalloc(sizeof(struct gpio_private), GFP_KERNEL); priv = kzalloc(sizeof(struct gpio_private), GFP_KERNEL);
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
mutex_lock(&gpio_mutex); mutex_lock(&gpio_mutex);
memset(priv, 0, sizeof(*priv));
priv->minor = p; priv->minor = p;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment