From patchwork Thu Oct 5 19:38:07 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: 822036 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 3y7NXb4z5Cz9t63 for ; Fri, 6 Oct 2017 06:45:19 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3y7NXb44w4zDrGD for ; Fri, 6 Oct 2017 06:45:19 +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.17.11; helo=mout.web.de; envelope-from=elfring@users.sourceforge.net; receiver=) Received: from mout.web.de (mout.web.de [212.227.17.11]) (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 3y7NVy1J0GzDqlF for ; Fri, 6 Oct 2017 06:43:53 +1100 (AEDT) Received: from [192.168.1.2] ([77.181.51.69]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LZeZU-1damq52Ssu-00lSdT; Thu, 05 Oct 2017 21:38:09 +0200 Subject: [PATCH 2/2] powerpc/platforms/cell: Improve a size determination in three functions From: SF Markus Elfring To: linuxppc-dev@lists.ozlabs.org, Arnd Bergmann , Benjamin Herrenschmidt , Jeremy Kerr , Michael Ellerman , Paul Mackerras References: Message-ID: Date: Thu, 5 Oct 2017 21:38:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:x0CvMmsKP6Kcd83Ley1G/lL0R2LcoVMOtW3dssOn8hFGWZnh0vB NeS6p5XWQSJu52V595njfBERiZubXKjerT4FAnDSS2RVOCAx4uN4kFlL6of+i5s7y9kW8Ci 8eCOdU5UCs+d1cozwLcV+JMUAkXncJPY2Q/36NLvQmvldR63c4OREvssaJKHZ90U0N+9HyV ZZGBHuD5Nx/jPpwGNfJDA== X-UI-Out-Filterresults: notjunk:1; V01:K0:Rh43kWQioiE=:nr0iwNOI1vgkK7iafTUsh6 C0dywOE+kq0/WWac4/BYAsy6lKRU8duiIqoV1+/nGE9BqkVTXwEskglBe/j4ZWIaY24U64ZV2 ueZd6NDNCx8/ilf5BDgNd/pOXJKagSixUZbbBuHoQ9xtbl3oDFQIDqhBBI9lg1N6Iej2nek9w JeAhJoalgrZWQ4bLUsP/ANmckAGVQHXDDYbLN6jTRxwbJsbXjJ9PZ6vcoLhiVTpIs2dciNpoE QWIWoJZmHXTgGD/T6sXAJxjrzpVsOo2UrjtPNKywJqOWH/vGu2rE43DM8TDqvqzosu8C12EGP ScNKWsjpo5eaxBScwmefJG0dFoyGZ8vbCcdBrNo3/WVP23GfrXzCzwwXtQoCNZQDREQjCwLQg RGg1Vz15mrKzJqs/XRx4xr3pVBH585mKpIKYxlOt4B6uoTWrwwQ05+v8uvJ4NxSnzou3hNK/T JZoEdWkneGXYHLgELGSV40aHOUnNMz6JurYbSIEjQdtanzrDMIpTztMuJ5/gM7L8OL411+uKN ij+93qM37FCyThK/hhem+vifnYtr9phA1gHdzx6cuMvwACXj9np9pdk6fOWfzaCj9X5Lncmy/ lRoR9kumG3UN75bX26bZ+iCJqJceyYxIstfivDUY6l775+Bni9rnWKvNuw5KD8pixlu9o9zqi tDu2nuNOPa5F078mmhbx1hKfY/yNvdjGHJli4wyLlo0snsMS2cTe0bCjKVDqfBrSt2CJdID3H ac4OW7kq4tFn+gf841kbpkkCfeQHHfBejqqCRM9SI6eAyjFm6+iPehqBrFjSu9i3zFnMCcP48 vOaGoA60LxTQzllkAL9lSGEFQ2PZkmClp9hW42k1ApaXvOYsEs= 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, 5 Oct 2017 21:12:41 +0200 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/cell/axon_msi.c | 2 +- arch/powerpc/platforms/cell/spider-pci.c | 2 +- arch/powerpc/platforms/cell/spufs/lscsa_alloc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c index 513d13d779b3..cc4987664841 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c @@ -342,7 +342,7 @@ static int axon_msi_probe(struct platform_device *device) pr_devel("axon_msi: setting up dn %pOF\n", dn); - msic = kzalloc(sizeof(struct axon_msic), GFP_KERNEL); + msic = kzalloc(sizeof(*msic), GFP_KERNEL); if (!msic) goto out; diff --git a/arch/powerpc/platforms/cell/spider-pci.c b/arch/powerpc/platforms/cell/spider-pci.c index 0a9f00563144..31919ff00124 100644 --- a/arch/powerpc/platforms/cell/spider-pci.c +++ b/arch/powerpc/platforms/cell/spider-pci.c @@ -131,7 +131,7 @@ int __init spiderpci_iowa_init(struct iowa_bus *bus, void *data) pr_debug("SPIDERPCI-IOWA:Bus initialize for spider(%pOF)\n", np); - priv = kzalloc(sizeof(struct spiderpci_iowa_private), GFP_KERNEL); + priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) return -1; diff --git a/arch/powerpc/platforms/cell/spufs/lscsa_alloc.c b/arch/powerpc/platforms/cell/spufs/lscsa_alloc.c index b847e9403566..d9de848dae47 100644 --- a/arch/powerpc/platforms/cell/spufs/lscsa_alloc.c +++ b/arch/powerpc/platforms/cell/spufs/lscsa_alloc.c @@ -36,7 +36,7 @@ int spu_alloc_lscsa(struct spu_state *csa) struct spu_lscsa *lscsa; unsigned char *p; - lscsa = vzalloc(sizeof(struct spu_lscsa)); + lscsa = vzalloc(sizeof(*lscsa)); if (!lscsa) return -ENOMEM; csa->lscsa = lscsa;