From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-input@vger.kernel.org,
Arvind Yadav <arvind.yadav.cs@gmail.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: [PATCH 2/2] Input: appletouch: Improve a size determination in atp_probe()
Date: Wed, 24 Jan 2018 20:57:56 +0100 [thread overview]
Message-ID: <ff27c617-d605-f65c-f707-df75b7f5df42@users.sourceforge.net> (raw)
In-Reply-To: <a86a6a93-21eb-4571-465c-24d4c0687965@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 24 Jan 2018 20:46:49 +0100
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/input/mouse/appletouch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index 3a709d21ea93..ea4888693889 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -866,7 +866,7 @@ static int atp_probe(struct usb_interface *iface,
}
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(struct atp), GFP_KERNEL);
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
input_dev = input_allocate_device();
if (!dev || !input_dev) {
dev_err(&iface->dev, "Out of memory\n");
--
2.16.1
prev parent reply other threads:[~2018-01-24 19:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-24 19:55 [PATCH 0/2] Input-appletouch: Adjustments for two function implementations SF Markus Elfring
2018-01-24 19:56 ` [PATCH 1/2] Input: appletouch: Delete an error message for a failed memory allocation in atp_geyser_init() SF Markus Elfring
2018-01-24 19:57 ` SF Markus Elfring [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=ff27c617-d605-f65c-f707-df75b7f5df42@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=arvind.yadav.cs@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@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;
as well as URLs for NNTP newsgroup(s).