From patchwork Wed Jan 24 17:40:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10182899 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 05F63601D5 for ; Wed, 24 Jan 2018 17:40:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2E802894F for ; Wed, 24 Jan 2018 17:40:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D73922895F; Wed, 24 Jan 2018 17:40:29 +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 6C7232894F for ; Wed, 24 Jan 2018 17:40:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964850AbeAXRk2 (ORCPT ); Wed, 24 Jan 2018 12:40:28 -0500 Received: from mout.web.de ([212.227.15.4]:55628 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964840AbeAXRk1 (ORCPT ); Wed, 24 Jan 2018 12:40:27 -0500 Received: from [192.168.1.2] ([77.181.242.198]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lp9kK-1fIyaL016S-00ewsU; Wed, 24 Jan 2018 18:40:25 +0100 Subject: [PATCH 2/2] Input: arc_ps2: Improve a size determination in two functions From: SF Markus Elfring To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <38a03d93-7663-f3c3-9066-88cd935e3790@users.sourceforge.net> Date: Wed, 24 Jan 2018 18:40:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:+Z/HI5qHJHQOHGuZ28zoSX/jMsSIw4ihZfKt8lD62+pwO4uQ5/x 0mtGyeb8RikpI6CbxSiR06AjB4vMe2ZvNR+95xyVftB9/bSTd9JVT5aIbyNFpCUBA3JQeps +QJ0dd+gjBE3YtezXg2e/xel6c0tzpfAH0mM4YYqbtrSQhl01cz9VMBGLGV5GZ14Wym4JOn xHH0cH7HcbTESyo4zmhDQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:SWpAjxV9nCI=:I7w45cSnuiqLafEXFEu9er wzGyGkQywDG7kcLtT3rS/hMMgGtGZ2EtaGhj1FgKW9kXVWrdz5MGKcMPNHUjz+lS5s8DTMCSs UPOXFLMtSqP5XpmUyb8blR59OUfdN3XvDmPXQb3jGeGHQN3OtVt3x+fX5J44Dj/MqBA4cniFO DIRZHYjNOUHfe3ChwrPE9ZYjebMTs9P5/80ACl8tNkcZ2cJJFaiyVSRMcIUP7vIxPj7PRjjHs txkg7HBVi+SBWh9exJr9t8tKVROtZWm3HKaAW89D33MdOj+WzGNMjb1zbAFqo56TA8kR3jNoc BmKYUAY2aS/HmqBLeBOgGA5SnwmIVl6Y1rOpvYZLJDQcDiBfgA/x7WkWr6gjBvK6yGzTEHMe7 KzgEbjCQjoBj0miL3Rh78FLYlkc/RszIRK6ODW6ISeLGclUN2zSm3h9pRsk/vdXo/zziFdIaM Bibbys0//vePQE3X56/Hjl09AHgD/+qRsfiTBniICp7zKYgsR7d4kXFtFaxJJlS81mn80vlJT YRHEysXbdAu6psTYAS216tXSYy92rV9tWyHS65SMtIOfn2FEpzYpA7QI6k8hBubAFw//m4Lfn PYlXMIkkej47vUSBaXML2LS9ht8rnp4qzvdaihx4OxDuSYjQvQHuhHKnUYncf8oR1jXDKFpcX lvSGnSoJmSgWDuo9amuYAVETs0UlVPQyPGZbFM+HaA9Jss2BlJOuWoZ0eRT+903CkOVKDGb1Q h1gP5hbRvXSJfEjB0fH104a7N3w56xrfhBDjNEewVcy3wWzQZbV5Riqujckt4LiWb9T9m02jl EoqIcdyoH+9mt6q1Vkju4ksxb+79YUSN7BeDnUi6MeQ7foZozs= 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: Wed, 24 Jan 2018 18:30:45 +0100 Replace the specification of data structures by pointer dereferences 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 --- drivers/input/serio/arc_ps2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/input/serio/arc_ps2.c b/drivers/input/serio/arc_ps2.c index 9860b1c1e67a..6a3c845e12ea 100644 --- a/drivers/input/serio/arc_ps2.c +++ b/drivers/input/serio/arc_ps2.c @@ -156,9 +156,8 @@ static int arc_ps2_create_port(struct platform_device *pdev, int index) { struct arc_ps2_port *port = &arc_ps2->port[index]; - struct serio *io; + struct serio *io = kzalloc(sizeof(*io), GFP_KERNEL); - io = kzalloc(sizeof(struct serio), GFP_KERNEL); if (!io) return -ENOMEM; @@ -195,8 +194,7 @@ static int arc_ps2_probe(struct platform_device *pdev) return -EINVAL; } - arc_ps2 = devm_kzalloc(&pdev->dev, sizeof(struct arc_ps2_data), - GFP_KERNEL); + arc_ps2 = devm_kzalloc(&pdev->dev, sizeof(*arc_ps2), GFP_KERNEL); if (!arc_ps2) return -ENOMEM;