From: Johan Hovold <johan@kernel.org>
To: Michael Estner <michaelestner@web.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
kernel-janitor-commits@vger.kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: usbtouchscreen: use kzalloc
Date: Sat, 12 Mar 2022 19:14:37 +0100 [thread overview]
Message-ID: <YizjDULjVcDQb6iR@hovoldconsulting.com> (raw)
In-Reply-To: <20220312172232.13146-1-michaelestner@web.de>
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
prev parent reply other threads:[~2022-03-12 18:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YizjDULjVcDQb6iR@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=kernel-janitor-commits@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michaelestner@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox