From patchwork Thu Jan 11 18:03:53 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: 859227 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zHYpP1j9Pz9s4s for ; Fri, 12 Jan 2018 05:10:53 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zHYpP0X8CzF0Vj for ; Fri, 12 Jan 2018 05:10:53 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=users.sourceforge.net (client-ip=212.227.15.4; helo=mout.web.de; envelope-from=elfring@users.sourceforge.net; receiver=) Received: from mout.web.de (mout.web.de [212.227.15.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zHYmZ36n7zDqhB for ; Fri, 12 Jan 2018 05:09:18 +1100 (AEDT) Received: from [192.168.1.3] ([92.227.255.105]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MUnuu-1eNeXm3qNo-00Y9jb; Thu, 11 Jan 2018 19:03:55 +0100 Subject: [PATCH 4/5] powerpc/4xx: Improve a size determination in two functions From: SF Markus Elfring To: linuxppc-dev@lists.ozlabs.org, Benjamin Herrenschmidt , Michael Ellerman , Paul Mackerras , Rob Herring , Tyrel Datwyler References: <2b9b4285-f1c0-5dc7-35c6-df901c9ca0eb@users.sourceforge.net> Message-ID: <8ac91d54-bd2b-42cb-f890-e3007489b758@users.sourceforge.net> Date: Thu, 11 Jan 2018 19:03:53 +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: <2b9b4285-f1c0-5dc7-35c6-df901c9ca0eb@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:J06GW6e8QqapTFFgkB2OMVFIoniUItxvJKLjpQVFy4qmFQFzZCn 9mlrEcSxJMvHoc4M8K5uaYVhxxdmaaShbb8/iRGqR7NUwRa09FLvhfdo5kLHuPAhJh2wByC /t8fhvXArEeEi0VzOo+z1z/608eD/y6dbkSGQT3Hh4Vvcuen1s4l5v6AgR/G1svQwcgW1Rp 0xPrI2Lm4fI2nV6iI/Hjg== X-UI-Out-Filterresults: notjunk:1; V01:K0:mVzTKRjpiyQ=:kG6aUg1xP1fnM54gSjmo7h Aub3ii+sq1vJZQ+UIdeTTApp4kiavRIyg8hY3Anl1mPH7/g3ia4xXDinLWnl6z4jdvLrtMuNX hlHWebBiY+cUFFWksolN3JtmEJLtCJaW5lBnsxbvTU/5CXaJbc4cuvSybpoGDeYs8rZYCp0sZ tIHHK/Qt6C0MYrgBVnlk9RA5jaBrit7ZHbSNb7z62MErwG2IDqyVasI4UXnBw9srRiDR5gByg yr4vp5miCD83Iw8SAt3SjF6k+WRKq54R4SBCuphGDwSNKOpRwmufUnjeTRqi5NSEMu1sILx0O e0ZfGSv9Qvz4ibOKb+6e+Hchu0S3DjGN+y2CCGnEhcVWyo1z9GK2l86MbrUGJ18jyYvEpqMb/ TDoz/asBLgLfkdrA309suSsfExWs7z6Xv1a2bPfu7HHNzrIh/8XW7cisN1/X6xrOjvSnlNxXU 895wtVNX+t7slDnGDCg+YWDdDyM8mYlyNU/uwgE2VotdUXMNzYnZsODNKc3KQStPhMOb2xsxo fKs2S5u7DP/h5jYrHdikkueuhx2lmId6UapqbS22T0xow2aE5CzMJRrfLVKK4c6ghQZO7k+Ht Gz7isjkpUzwg3ERRgMJl6+AlSp2Z15xG7DxDHYdsErb8/saCV21hf7h0Q7wjkLJUGqTsG45r1 qSOMKFtJSd7rQYwdduuxTa8Iya9K0wzPaZi6lAGhYbxoi26JmytKd/0WKRBt7TYc1o9wMkwiT cFblTId9NQvXgR4y9vBREV2imdmZ/URM52x9K9esXKgTnRTveckdv5BP70vFWU2BAzA46C3Cy eF1HNv8jFWB1WPdQS6bMb1+DIUG3lam9yLTRZ9L7j6xJ9NJZJg= X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, LKML Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Markus Elfring Date: Thu, 11 Jan 2018 18:32:33 +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 --- arch/powerpc/platforms/4xx/msi.c | 2 +- arch/powerpc/platforms/4xx/ocm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/4xx/msi.c b/arch/powerpc/platforms/4xx/msi.c index d16b81303cb0..f693cab07752 100644 --- a/arch/powerpc/platforms/4xx/msi.c +++ b/arch/powerpc/platforms/4xx/msi.c @@ -223,7 +223,7 @@ static int ppc4xx_msi_probe(struct platform_device *dev) dev_dbg(&dev->dev, "PCIE-MSI: Setting up MSI support...\n"); - msi = kzalloc(sizeof(struct ppc4xx_msi), GFP_KERNEL); + msi = kzalloc(sizeof(*msi), GFP_KERNEL); if (!msi) return -ENOMEM; diff --git a/arch/powerpc/platforms/4xx/ocm.c b/arch/powerpc/platforms/4xx/ocm.c index 5a750d0ad446..11418f090bf4 100644 --- a/arch/powerpc/platforms/4xx/ocm.c +++ b/arch/powerpc/platforms/4xx/ocm.c @@ -335,7 +335,7 @@ void *ppc4xx_ocm_alloc(phys_addr_t *phys, int size, int align, if (IS_ERR_VALUE(offset)) continue; - ocm_blk = kzalloc(sizeof(struct ocm_block), GFP_KERNEL); + ocm_blk = kzalloc(sizeof(*ocm_blk), GFP_KERNEL); if (!ocm_blk) { rh_free(ocm_reg->rh, offset); break;