From patchwork Tue Apr 25 15:14:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9698461 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A2012603F4 for ; Tue, 25 Apr 2017 15:16:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A3D52862A for ; Tue, 25 Apr 2017 15:16:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8EEDC28665; Tue, 25 Apr 2017 15:16:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E441F28660 for ; Tue, 25 Apr 2017 15:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1949029AbdDYPPq (ORCPT ); Tue, 25 Apr 2017 11:15:46 -0400 Received: from mout.web.de ([212.227.15.3]:61618 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1949065AbdDYPPa (ORCPT ); Tue, 25 Apr 2017 11:15:30 -0400 Received: from [192.168.1.2] ([92.228.145.161]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lsy7e-1c0jD00t0E-012WCF; Tue, 25 Apr 2017 17:14:56 +0200 Subject: [PATCH 2/3] HID: Wacom: Improve size determinations in three functions From: SF Markus Elfring To: linux-input@vger.kernel.org, Benjamin Tissoires , Jiri Kosina Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Tue, 25 Apr 2017 17:14:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:0vCzCf7iU3J/FW/JQ4tLnrBgiTYPd8t9NAS31yRj808KewozNGs XkxKZs2glKlB7lmcudWJ1dYt/4Mb9VahCUQ1hhFVEl/RnWp1lUF4gDCt3I3Por+yS2lszzj NMceYHHtHPY2GoFC2ZBVfIPg7wctnkgG8PYo75sVg4+pQ2J4jjG1Fplo0eYsbE4Tf0RMSWu HlpZIlMcnbQAMhcih38og== X-UI-Out-Filterresults: notjunk:1; V01:K0:3GvSfsx2+rA=:7uzMrjRWne8IubDa8/pi8n +kFWm3EmIalLETTw3QV3z8kDBu7rPyiouzFAxKSwfP2HdlA1epW/JnUlfNOarhZAT5HJ62LLc kJpLcyfxYMyn8tnD/fcEhVfV6LGtDOpkwtflp0Zywl9nslJ6ybBmwR3V04nVHA6X4SflGKCeI 4WGL4PP/gRhs0eMmoZX7vPoVLwZpXv7qVdDEk3fH/8cm2cC8JF3tR6K8wYfAaQjG7c2NL6nE7 NyC/HUvyLvTequqfsrCbkZ5NA+17GKjsfSfKy0nPy5HZSoweXCMgzhJa0hJd/BoGdS9DEmldg tDiDmDM4odGAsbtcjiA/bffbQ1bJn8fUHGCHzRcvj3iNBSjbzNnxpkocS8KgcXaYIPAXJHte7 /cSLcbfJ1kBB8bvc0bwZ3JjErK0oK+A7C1l3+6k/NuITpNzkWMs4mlS685qMCMcRK2JTXdeDM XGze/f6RtSbnFZ3NvrtjZWVXw2QCSkbx6/85OpUus6NUQ44SD51nDAj7JPJG+YZOGNNY7dp6/ jG1wtuPitJU3krtKad9j6AeppBiw/yusCevHSbbxsZlXeArZMTxYXQa0ndd+pGKYjTv1W2hDn KPhMol8Peq+cpbRTz7+pOgwqSzQcfteVbFVevCSfj/fHZ64DD4gwm7GjMvr7AlgyWWZ5+WPRw a/LgqJyBd0JkJ6dxRccUYpa1nHjExcMChULYHm7m90L6KUUlAoFjfA5jaanRpgaNcEqN4/gLO FoapSDQJ9Ckdh/ChczuRr1THi3SVDGb7IuPDW4MNUBjclmmm/fq5/MQuzuoYwx+yTygkTTMZ5 jBDzozi Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring 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 --- 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;