* [PATCH] cris: arch-v32: gpio: Use kzalloc instead of kmalloc/memset
@ 2015-05-01 13:58 Christophe Jaillet
2015-05-11 11:21 ` Jesper Nilsson
0 siblings, 1 reply; 3+ messages in thread
From: Christophe Jaillet @ 2015-05-01 13:58 UTC (permalink / raw)
To: starvik, jesper.nilsson
Cc: linux-cris-kernel, linux-kernel, kernel-janitors,
Christophe Jaillet
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cris: arch-v32: gpio: Use kzalloc instead of kmalloc/memset
2015-05-01 13:58 [PATCH] cris: arch-v32: gpio: Use kzalloc instead of kmalloc/memset Christophe Jaillet
@ 2015-05-11 11:21 ` Jesper Nilsson
0 siblings, 0 replies; 3+ messages in thread
From: Jesper Nilsson @ 2015-05-11 11:21 UTC (permalink / raw)
To: Christophe Jaillet
Cc: Mikael Starvik, Jesper Nilsson, linux-cris-kernel,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
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 <christophe.jaillet@wanadoo.fr>
/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson@axis.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] cris: arch-v32: gpio: Use kzalloc instead of kmalloc/memset
@ 2015-07-07 5:55 Christophe JAILLET
0 siblings, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2015-07-07 5:55 UTC (permalink / raw)
To: starvik, jesper.nilsson
Cc: linux-cris-kernel, linux-kernel, kernel-janitors,
Christophe JAILLET
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>
---
A simililar patch has already been applied against
arch/cris/arch-v32/drivers/mach-fs/gpio.c
---
arch/cris/arch-v32/drivers/mach-a3/gpio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/cris/arch-v32/drivers/mach-a3/gpio.c b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
index 74f9fe8..75f0264 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
@@ -386,13 +386,12 @@ static int gpio_open(struct inode *inode, struct file *filp)
(p > GPIO_MINOR_LAST && p < GPIO_MINOR_PWM0))
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;
filp->private_data = priv;
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-07 5:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-01 13:58 [PATCH] cris: arch-v32: gpio: Use kzalloc instead of kmalloc/memset Christophe Jaillet
2015-05-11 11:21 ` Jesper Nilsson
-- strict thread matches above, loose matches on Subject: below --
2015-07-07 5:55 Christophe JAILLET
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox