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 <[email protected]>
---
arch/cris/arch-v32/drivers/mach-fs/gpio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/cris/arch-v32/drivers/mach-fs/gpio.c b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
index 009f4ee..72968fb 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
@@ -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;
--
2.1.0
On Fri, May 01, 2015 at 03:58:19PM +0200, Christophe Jaillet wrote:
> Turn a kmalloc/memset into an equivalent kzalloc.
> Doing so also move the zero'ing of the memory outside of a mutex.
Agreed, thanks!
> Signed-off-by: Christophe Jaillet <[email protected]>
/^JN - Jesper Nilsson
--
Jesper Nilsson -- [email protected]