From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-input@vger.kernel.org,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Jiri Kosina <jikos@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/3] HID: Wacom: Improve size determinations in three functions
Date: Tue, 25 Apr 2017 17:14:54 +0200 [thread overview]
Message-ID: <f6088931-7b68-ec9d-cc7f-5d48431cef56@users.sourceforge.net> (raw)
In-Reply-To: <d126aeeb-f7e0-e54b-b874-61d776fe45cb@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Apr 2017 16:38:59 +0200
Replace the specification of three data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determinations a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/hid/wacom_sys.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 550faf8819ea..7517da5300fd 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -726,7 +726,7 @@ static int wacom_add_shared_data(struct hid_device *hdev)
data = wacom_get_hdev_data(hdev);
if (!data) {
- data = kzalloc(sizeof(struct wacom_hdev_data), GFP_KERNEL);
+ data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data) {
retval = -ENOMEM;
goto out;
@@ -1088,7 +1088,7 @@ static int __wacom_devm_sysfs_create_group(struct wacom *wacom,
int error;
devres = devres_alloc(wacom_devm_sysfs_group_release,
- sizeof(struct wacom_sysfs_group_devres),
+ sizeof(*devres),
GFP_KERNEL);
if (!devres)
return -ENOMEM;
@@ -2556,7 +2556,7 @@ static int wacom_probe(struct hid_device *hdev,
/* hid-core sets this quirk for the boot interface */
hdev->quirks &= ~HID_QUIRK_NOGET;
- wacom = devm_kzalloc(&hdev->dev, sizeof(struct wacom), GFP_KERNEL);
+ wacom = devm_kzalloc(&hdev->dev, sizeof(*wacom), GFP_KERNEL);
if (!wacom)
return -ENOMEM;
--
2.12.2
next prev parent reply other threads:[~2017-04-25 15:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-25 15:12 [PATCH 0/3] HID-Wacom: Fine-tuning for seven function implementations SF Markus Elfring
2017-04-25 15:13 ` [PATCH 1/3] HID: Wacom: Use devm_kcalloc() in two functions SF Markus Elfring
2017-06-05 15:29 ` Jason Gerecke
2017-04-25 15:14 ` SF Markus Elfring [this message]
2017-04-25 15:15 ` [PATCH 3/3] HID: Wacom: Delete two unnecessary return statements SF Markus Elfring
2017-05-15 17:18 ` [PATCH 0/3] HID-Wacom: Fine-tuning for seven function implementations Jason Gerecke
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=f6088931-7b68-ec9d-cc7f-5d48431cef56@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=kernel-janitors@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;
as well as URLs for NNTP newsgroup(s).