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: Christophe Jaillet <christophe.jaillet@wanadoo.fr> Signed-off-by: Jesper Nilsson <jespern@axis.com>
This commit is contained in:
parent
51e771c0d2
commit
6a4756f695
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user