Linux Input/HID development
 help / color / mirror / Atom feed
From: Michael Estner <michaelestner@web.de>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: kernel-janitor-commits@vger.kernel.org,
	Michael Estner <michaelestner@web.de>,
	Johan Hovold <johan@kernel.org>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drivers: usbtouchscreen: use kzalloc
Date: Sat, 12 Mar 2022 18:22:30 +0100	[thread overview]
Message-ID: <20220312172232.13146-1-michaelestner@web.de> (raw)
In-Reply-To: <Michael Estner <michaelestner@web.de>

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


       reply	other threads:[~2022-03-12 17:35 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 ` Michael Estner [this message]
2022-03-12 18:14   ` [PATCH] drivers: usbtouchscreen: use kzalloc Johan Hovold

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=20220312172232.13146-1-michaelestner@web.de \
    --to=michaelestner@web.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=johan@kernel.org \
    --cc=kernel-janitor-commits@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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