Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965731AbeAOPPl (ORCPT + 1 other); Mon, 15 Jan 2018 10:15:41 -0500 Received: from mout.web.de ([212.227.15.4]:53639 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933557AbeAOPPj (ORCPT ); Mon, 15 Jan 2018 10:15:39 -0500 Subject: [PATCH 2/3] mfd/sm501: Improve a size determination in two functions From: SF Markus Elfring To: kernel-janitors@vger.kernel.org, Lee Jones Cc: LKML References: Message-ID: <3b264527-b43f-b6aa-0570-c6d48ed24679@users.sourceforge.net> Date: Mon, 15 Jan 2018 16:15:36 +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-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:np9I/yb/QzEoKZm7Sj7+CLiGwQHs2ySNkVNA1MDla9GT6DstQ4Y M5jl9XS5aKXG7Rojibql4giKCfIfZm09X3JDONAM1AzXtT4nxLJDNF3RGSnThrTPEf9ELZ3 XI1ZWbwhuTGMTpM9Kqt4ye9XvgA9bztTnUSUC4kXw5cMC4ZchxWhvwhmncHqtvgXzaY13nb nnHRwpcfmGJuRg6Sel/2A== X-UI-Out-Filterresults: notjunk:1;V01:K0:0784LZnknu0=:F2NELy10oIyMOIYhDLf//A /Itu7lXCnT5fYjmRukuyacLET+kC57OflR0ovkzxVZBpUdVpVe2EpRr8gz1xS/fbzU3QBzqTB ydLk+wRhXpCyzAI+25mZyEsxs7H/W2hglGhVOJGKhDEIo99pITuLCV4GqU3ZnWdHreaFJBJcA qM4meG8USSWPrAow6mo+ebi04GY3VoBXgyfE0cB9644orhXNOcS9reDuDQ6FrEGAnaeI55eqD wFZwqTcVRuxgv5TTTuW1Hd4hn/sn//XebwnszjOqCU6+tnPc9sUxg7uZedAMwmMR2CxqeHGgu /7K0oTsi6/58XM7jHBzHK86UYtZNGK82I5py1BD334221YwZq1h9B+IrND6v/hpX3tSkoh/Yh KvzgJkl/LR6fvKjcpNitIBTONWCGuPc1ovh9IEvbX+JSWye/jXHN/xtMbjohJ9s7tDUAjuYAo aspzpwcYgYtQTEBXQ1cEUecAXLGot7chfxfa+qdFB9s/bzBmg3wTgWjevwp0pB28V07L1H391 oYylnpJnaPzafCZMPhFhQveql1UB/ceukYArZtkwJ04L6buLPTWgtpiz5Dxhkzix8qg09CIzZ 2fgzQRy4aHh2Rk9maCwbeR/rva+x5WXDHBfMz3BsznUCDsRIu1Xxe9qFJAe2Hl2OTwtewXMTQ O/cpx7tSiSi+/4RucOsYBZOEHigXRgX6L3RWK6OBQYI1oKSkZNjenER6PXocs4jcdemTyQiXN zhZkUabXv18rSCivJ5CrDd/zLTq7MazRQ1ulXcNtpV0R7SUMRX19eNT4a+nVkJrZtXFBycrLG a2D2yZ8/zl661ceuBlxdAAh9in+LPZuwNpyBgpp18L/806vwE8= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Markus Elfring Date: Mon, 15 Jan 2018 15:47:03 +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/mfd/sm501.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 7298d6b571a1..d5ab3481794a 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1380,10 +1380,9 @@ static int sm501_init_dev(struct sm501_devdata *sm) static int sm501_plat_probe(struct platform_device *dev) { - struct sm501_devdata *sm; int ret; + struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL); - sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL); if (sm == NULL) { ret = -ENOMEM; goto err1; @@ -1569,10 +1568,9 @@ static struct sm501_platdata sm501_pci_platdata = { static int sm501_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { - struct sm501_devdata *sm; int err; + struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL); - sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL); if (sm == NULL) { err = -ENOMEM; goto err1; -- 2.15.1