* [PATCH] drivers: usbtouchscreen: use kzalloc [not found] <Michael Estner <michaelestner@web.de> @ 2022-03-12 17:22 ` Michael Estner 2022-03-12 18:14 ` Johan Hovold 0 siblings, 1 reply; 2+ messages in thread From: Michael Estner @ 2022-03-12 17:22 UTC (permalink / raw) To: Dmitry Torokhov Cc: kernel-janitor-commits, Michael Estner, Johan Hovold, linux-input, linux-kernel 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 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers: usbtouchscreen: use kzalloc 2022-03-12 17:22 ` [PATCH] drivers: usbtouchscreen: use kzalloc Michael Estner @ 2022-03-12 18:14 ` Johan Hovold 0 siblings, 0 replies; 2+ messages in thread From: Johan Hovold @ 2022-03-12 18:14 UTC (permalink / raw) To: Michael Estner Cc: Dmitry Torokhov, kernel-janitor-commits, linux-input, linux-kernel On Sat, Mar 12, 2022 at 06:22:30PM +0100, Michael Estner wrote: > 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); NAK The new code is not equivalent to the old so that semantic patch must be broken. The current code is clearing the buffer before each read, after this patch it would only be cleared once. Johan ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-12 18:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <Michael Estner <michaelestner@web.de>
2022-03-12 17:22 ` [PATCH] drivers: usbtouchscreen: use kzalloc Michael Estner
2022-03-12 18:14 ` Johan Hovold
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox