lkml.org 
[lkml]   [2022]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] drivers: usbtouchscreen: use kzalloc
Date
Use kzalloc instead of kmalloc + memset.

The semantic patch that makes this change is:
(https://coccinelle.gitlabpages.inria.fr/website/)

Signed-off-by: Michael Estner <michaelestner@web.de>
---
drivers/input/touchscreen/usbtouchscreen.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 43c521f50c85..159e1ac6198a 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -975,7 +975,7 @@ static int nexio_init(struct usbtouch_usb *usbtouch)
if (!input_ep || !output_ep)
return -ENXIO;

- buf = kmalloc(NEXIO_BUFSIZE, GFP_NOIO);
+ buf = kzalloc(NEXIO_BUFSIZE, GFP_NOIO);
if (!buf)
goto out_buf;

@@ -998,7 +998,6 @@ static int nexio_init(struct usbtouch_usb *usbtouch)

/* read replies */
for (i = 0; i < 3; i++) {
- memset(buf, 0, NEXIO_BUFSIZE);
ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, input_ep),
buf, NEXIO_BUFSIZE, &actual_len,
NEXIO_TIMEOUT);
--
2.25.1
\
 
 \ /
  Last update: 2022-03-12 18:36    [W:0.686 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site