diff mbox

Input: byd: don't wipe dynamically allocated memory twice

Message ID 1461268697-30735-1-git-send-email-vz@mleia.com (mailing list archive)
State Accepted
Headers show

Commit Message

Vladimir Zapolskiy April 21, 2016, 7:58 p.m. UTC
Since memory for a private data is allocated by kzalloc() there is no
need to fill it with zeroes immediately after the allocation.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
---
 drivers/input/mouse/byd.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Dmitry Torokhov April 26, 2016, 4:50 p.m. UTC | #1
On Thu, Apr 21, 2016 at 10:58:17PM +0300, Vladimir Zapolskiy wrote:
> Since memory for a private data is allocated by kzalloc() there is no
> need to fill it with zeroes immediately after the allocation.
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>

Applied, thank you.

> ---
>  drivers/input/mouse/byd.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/input/mouse/byd.c b/drivers/input/mouse/byd.c
> index fdc243c..ec73f75 100644
> --- a/drivers/input/mouse/byd.c
> +++ b/drivers/input/mouse/byd.c
> @@ -473,9 +473,8 @@ int byd_init(struct psmouse *psmouse)
>  	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
>  	if (!priv)
>  		return -ENOMEM;
>  
> -	memset(priv, 0, sizeof(*priv));
>  	setup_timer(&priv->timer, byd_clear_touch, (unsigned long) psmouse);
>  
>  	psmouse->private = priv;
>  	psmouse->disconnect = byd_disconnect;
> -- 
> 2.1.4
>
diff mbox

Patch

diff --git a/drivers/input/mouse/byd.c b/drivers/input/mouse/byd.c
index fdc243c..ec73f75 100644
--- a/drivers/input/mouse/byd.c
+++ b/drivers/input/mouse/byd.c
@@ -473,9 +473,8 @@  int byd_init(struct psmouse *psmouse)
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
-	memset(priv, 0, sizeof(*priv));
 	setup_timer(&priv->timer, byd_clear_touch, (unsigned long) psmouse);
 
 	psmouse->private = priv;
 	psmouse->disconnect = byd_disconnect;