From patchwork Mon May 8 13:06:12 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: 9716189 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 52BE760364 for ; Mon, 8 May 2017 13:06:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AE7E22B39 for ; Mon, 8 May 2017 13:06:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DCDE26B39; Mon, 8 May 2017 13:06:33 +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 DD0C122B39 for ; Mon, 8 May 2017 13:06:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754757AbdEHNGS (ORCPT ); Mon, 8 May 2017 09:06:18 -0400 Received: from mout.web.de ([217.72.192.78]:64708 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753681AbdEHNGQ (ORCPT ); Mon, 8 May 2017 09:06:16 -0400 Received: from [192.168.1.3] ([77.182.37.117]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LqUPN-1dcwS41Pc1-00e6kf; Mon, 08 May 2017 15:06:13 +0200 Subject: [PATCH 3/3] Input: Improve a size determination in four functions From: SF Markus Elfring To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: LKML , kernel-janitors@vger.kernel.org References: <85bf6874-661a-9cab-1e9b-ea9e312b94de@users.sourceforge.net> Message-ID: Date: Mon, 8 May 2017 15:06:12 +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: <85bf6874-661a-9cab-1e9b-ea9e312b94de@users.sourceforge.net> Content-Language: en-US X-Provags-ID: V03:K0:SdBJMYQ/NGdrAQ5ByVAO2u55WfG8r9hyGfpj+0otwxAaPq2rhLf v/+jpXcPAQwyfH2y5CRfqyfbFeZPMDgot3utPtadoCqZO0k0gtqfdXIAvjSUKzwnU5FZVGM QUFh97P7DFK6QzCeVt1+bKbnuvRPOKnsss9tJNynduYu/ZZeCrbCwCg+3rqaeAR6Qf+z33j P89aOeMAEJ358+KMGqTxQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:4tfA8meGGKY=:O7eCwbkZcsF9/EX+I6UZ7P 4mVXmO7sDl8DPjoouL+FZlHtWcOq1tE85N6bmIGkiqnBNFk3l1+TBBL4jmMHbHryVheU8OywV /Lv9aGoRbhFZwM7Cum82ruRYLH/spg742Psn/ki+Mn/NjFcQJDBUXhorNeh3wI2Eg4Dsl/MJM FJuLIth2gnT7+xynQ3erq1sCVa6+X9R4Ij3HP9K0423P4xXK2UVjZ+SYhDqUADo2tjcTWUfHF c/AFOnNi3vCT+vnbXr0uFjPQ2fpeE5kpsiFCTPQ4zev4H5uwVUUIJIdPyf6YiA98TcembmXg3 c7hBTu44w81MuJsHiL5Xn2tgepnVcF/TedBvhHswwyVAF5qB2jOSWxOblIBarKcW0kynb7ReY KLqfQ31PCqUVEqPN+2kQMPF9iDTBrerlvYPoJLXoDoTNe/yatVnGnxbvYbgk8c6N4o55vuqXh wAMEAMYomJQ/Sb6Vzj75yCX5uZ2RwGiZl5cKG4TST5h2U+CJJqztZUiYvql4e9TeQlOHF5/Zf wJph6nsmIHr9Y/lLRicsLDctgIqk5CwQF8fKG+7Ofw9k4zrpKEbR5UdvkFgCDYqhUhKJxJgWU 1/q8B6NFGNla3whDDZMKLOpd0AslwiECdmirtj6vQD7uO9zv2zW1sSylPl2yjcgCPqIhL0stK oeHFRGVXOB3LY0UQsZm3RnK2Mwe0aAab0Ju97PkSx0p6TaRCi3amvw2UoKRQlRlADK6dnPnzH GVM8jVcRz+iZaRH121TT9LqUlqWK3GrGtlRMcsY26VRqbZTlBhu7SGaoTlQWAThjYl79S/vxc dVqOz6O 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: Mon, 8 May 2017 14:54:26 +0200 Replace the specification of four 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. Signed-off-by: Markus Elfring --- drivers/input/input.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index 067a6edd643c..7e6842bd525c 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -481,7 +481,7 @@ EXPORT_SYMBOL(input_inject_event); void input_alloc_absinfo(struct input_dev *dev) { if (!dev->absinfo) - dev->absinfo = kcalloc(ABS_CNT, sizeof(struct input_absinfo), + dev->absinfo = kcalloc(ABS_CNT, sizeof(*dev->absinfo), GFP_KERNEL); WARN(!dev->absinfo, "%s(): kcalloc() failed?\n", __func__); @@ -1783,7 +1783,7 @@ struct input_dev *input_allocate_device(void) static atomic_t input_no = ATOMIC_INIT(-1); struct input_dev *dev; - dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL); + dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (dev) { dev->dev.type = &input_dev_type; dev->dev.class = &input_class; @@ -1849,7 +1849,7 @@ struct input_dev *devm_input_allocate_device(struct device *dev) struct input_devres *devres; devres = devres_alloc(devm_input_device_release, - sizeof(struct input_devres), GFP_KERNEL); + sizeof(*devres), GFP_KERNEL); if (!devres) return NULL; @@ -2099,7 +2099,7 @@ int input_register_device(struct input_dev *dev) if (dev->devres_managed) { devres = devres_alloc(devm_input_device_unregister, - sizeof(struct input_devres), GFP_KERNEL); + sizeof(*devres), GFP_KERNEL); if (!devres) return -ENOMEM;