lkml.org 
[lkml]   [2015]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] cris: arch-v32: gpio: Use kzalloc instead of kmalloc/memset
Date
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>
---
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


\
 
 \ /
  Last update: 2015-05-01 16:41    [W:0.059 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site