Received: by 10.223.176.46 with SMTP id f43csp2508527wra; Thu, 25 Jan 2018 10:56:22 -0800 (PST) X-Google-Smtp-Source: AH8x224gvR8IT/Nfu2wSw+QUqYkkw4iC5Z4qPepKPudugr6tqbZG3T6TOORqQzPA4Xw5Nj1KDkG7 X-Received: by 10.98.36.77 with SMTP id r74mr17086905pfj.31.1516906582259; Thu, 25 Jan 2018 10:56:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516906582; cv=none; d=google.com; s=arc-20160816; b=Gk2/sme4hvOtdeUaXSD7dvxeCzKCOxtPCHiH+ZtYKLaO10j+zeus7SFBE6hMGhwu8g r6Prm76jSYo6KwxIurqe4CEWlmhAgTN2PGoJs9SFB3HEygxCifu7PjSDdxfXjiQj4W8W OtZbPXRBSPFL5VpHTKbk/u/VZNvE9COiAxbpHLtblDtgaPRTsGgSrfsqnERTTZV6pKGs /c6JaHYjXotX4mIdlCfKbI41zc+D7nzBKWNYKuYVQTtSLj9qhR/djMC26P04q6OJDaD9 zCJsvBO8OOMQlToKn3UABtW0fYbtxkePQCRGTpkkx/Mo9lGHe5q5hDbppsgDwMwpvMBc W3KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:arc-authentication-results; bh=g+xtPf/KiE/1fcVszWCixBUx6Tv50SyYmTu11dumAGA=; b=rlZrTv/N0AqgSHXlqV10PncHsof0IvgLQQw7W+WNlh8VQCxeZmcHF5NT8HRqgcPQiV BLCVjncnFJPv4lf0FiNpA8ZRqeCl6Y2DrFZ1eXKx6vGlz6l3boh9YrkIIF0eVPyVcx7M AbpUFv/Pzo0gwW7zy4fSGzJnOzgFYEFmhPdPiSiG99bsiiOx5hcFLhzupO+9nDky1vo6 RLs/TDeMKFishdu70+EmkevEJRlgHegWegFrUvA9w2lMKUUM17w20k3xg6IjD1FLWgr/ 8kDgcWLYBsCtLhNFHOE2gWZb4BSn6Mxi6eQ/HgAsKUGXZML2RdVBCrX9xSKJiN8Yzxxh 1aIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14-v6si2377231pll.758.2018.01.25.10.56.08; Thu, 25 Jan 2018 10:56:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751365AbeAYSyD (ORCPT + 99 others); Thu, 25 Jan 2018 13:54:03 -0500 Received: from mout.web.de ([212.227.15.4]:63143 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751183AbeAYSyB (ORCPT ); Thu, 25 Jan 2018 13:54:01 -0500 Received: from [192.168.1.2] ([92.227.186.52]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MHp7t-1edxhr0M2v-003hRz; Thu, 25 Jan 2018 19:53:50 +0100 Subject: [PATCH 2/3] Input: ims-pcu: Improve a size determination in two functions From: SF Markus Elfring To: linux-input@vger.kernel.org, Arvind Yadav , Dmitry Torokhov , Joe Perches , Johan Hovold , Zhen Lei Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <1819bb70-3c2c-a86a-29a2-5fb049c3f194@users.sourceforge.net> Date: Thu, 25 Jan 2018 19:53:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:Jci1KLZDvRS+v38H1Phwssfw+TlkLkvUfkcKF0EprbyMnAVIwNY 1YqxoHxubgyBPXR0lB8jW/xPDeBVoQ1I3ilHzSckIm9DOj5CKmCrsyc73t8XK8f8qsWAstg UTxPk8C9ebLsu/Qx4dChxIPZlM+xZyfH0HNBLwTvDPADaPgYeHyvXNFJ38EXyyOBsd0VSz2 1oiAGnkorVDBY7g+MsM+A== X-UI-Out-Filterresults: notjunk:1;V01:K0:py/csLaaOcE=:XB319WpqDQlcExL3FRVzSh xalkiC0ahVsRqZK/mhjETvWSNhTs6iSokkbDnbPiihYU/c9Zjp82JcC/BWY+PIYegqFzPcDct ds9fieRc+GC0PDR7p5TwyPhWnX7JSsZEz4qd/PJUFX+AhXis2cZQKdWsQk6LvVzLwwAFKJ6WV XVudMZB1FZdRK0/XYire1cStRNLiHJSJBPbMF3WX4U4Pu3vH3zE7hE+zFB0rRNGCbVqSOK0v9 kWSFomYSPp39y7Et99Nx02Gx4S32OtFCT1A73SCeipf42Syxj8WcXqlFTSCVfzjU3ijkavpZx Qun8KTGCy/wtxVGZjzHzB5J5BU/rOK5Uqe8sd5A1mZdv1boofXJjLH5ZxMTZj6OSFcBH3rK5r Yf8UByFZiVh5qxcZeziQYHyMKbATxu0Bhno4bZBVUej4FiKNiT8w7lVL+Yjgwq5CiM1aVvQTu VKRekziLHbW19FZtVCko69nUZTa7jGpOovE1jb3oFIzcn0Kdx/HpxFKtKEr5BBtXbBKJIBi8I DKntrD6Xb6nikNoASctDJKKCHIQjHrTgPKs8rQAZCY8jW2vJDaevKQuJ0B13RvxDCvL6ieSi9 cL4DbuU2G26vc3gWbcUSORREd7MPTrnf+odGCPihYKcagFAg+X8TLfQ6hsIygrY6pD9UZzKTZ UrUN1GXxAxJynyiluc4FNNtdlUGL5CDPXqAsIWhH34QZk7TIUtYL++DDHKPW+4gCjQjySVDfC bdA51g7Tgc4rYIL5yj6mOwEW5pe9qS8LhwRpQxxy2xc16/O3Fv8gELQ8XBBRyyWIjxAYHWeYF I5DSZBFjLwNz4YObzYdy5UmPbj7GVMgWTFfNdDvEqnd+4A5dsQ= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Thu, 25 Jan 2018 19:20:38 +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/misc/ims-pcu.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c index 4aca2a02ff6d..d7778b273151 100644 --- a/drivers/input/misc/ims-pcu.c +++ b/drivers/input/misc/ims-pcu.c @@ -288,12 +288,10 @@ static void ims_pcu_gamepad_report(struct ims_pcu *pcu, u32 data) static int ims_pcu_setup_gamepad(struct ims_pcu *pcu) { - struct ims_pcu_gamepad *gamepad; - struct input_dev *input; int error; + struct ims_pcu_gamepad *gamepad = kzalloc(sizeof(*gamepad), GFP_KERNEL); + struct input_dev *input = input_allocate_device(); - gamepad = kzalloc(sizeof(struct ims_pcu_gamepad), GFP_KERNEL); - input = input_allocate_device(); if (!gamepad || !input) { dev_err(pcu->dev, "Not enough memory for gamepad device\n"); @@ -2003,10 +2001,9 @@ static int ims_pcu_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(intf); - struct ims_pcu *pcu; int error; + struct ims_pcu *pcu = kzalloc(sizeof(*pcu), GFP_KERNEL); - pcu = kzalloc(sizeof(struct ims_pcu), GFP_KERNEL); if (!pcu) return -ENOMEM; -- 2.16.1