From patchwork Tue Oct 17 18:56:53 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: 827246 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 3yGkyM0QF0z9t3H for ; Wed, 18 Oct 2017 05:59:39 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yGkyL6MbPzDrT7 for ; Wed, 18 Oct 2017 05:59:38 +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 3yGkvx1zmBzDrKC for ; Wed, 18 Oct 2017 05:57:32 +1100 (AEDT) Received: from [192.168.1.2] ([92.228.183.125]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0McT8i-1dmrdZ2JKi-00HgVr; Tue, 17 Oct 2017 20:56:57 +0200 Subject: [PATCH 2/2] powerpc-ps3: Improve a size determination in two functions From: SF Markus Elfring To: linuxppc-dev@lists.ozlabs.org, Benjamin Herrenschmidt , Geoff Levand , Michael Ellerman , Paul Mackerras References: <36a8ba41-7f1e-31f8-5d32-19e04393b181@users.sourceforge.net> Message-ID: Date: Tue, 17 Oct 2017 20:56:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <36a8ba41-7f1e-31f8-5d32-19e04393b181@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:xIVjjMpOc68v2qtK49SAOr0Umf8mjLn39kxhnaSe7bpujrPfu7R m0+ucB637CrXQCLBEzmR/jqK19aaSegHWLeriUh51M9ou2m3U5SAbvXcW3RBXRB85U9XEny 6WbfqJz9T19B0coxZL4/ZyKCEbi3F39WSheo2524HB389pj+EOjnKUQq2AqbNR2z/7hwlfF qQttNQg9zO2+dB8piS0nw== X-UI-Out-Filterresults: notjunk:1; V01:K0:ljFANmFsSoY=:X2ZCN/f867FzBpYX6kwm6C pCv5jmMvyJ1f/n6P+uhQwMNtp5jUdRyNn4OOF9GH+vbPRIzlFJmeOtyh2n8iQBFbUr1EXU+ya UI5kBe6tuVujg+4/Lo357fPKmiQxFNwrtPwUuGxb4PkbWF2TfMQ66+a0Dwk7zhRFJZHuqu/1M E8SFgt5fVyI0r1O//t+RJP4MgAu/O+ang7XJTUAh1cTDHnB2vlFHUNDC7q81S2SSPkNLlvMzC C/9/9ij0dx6HnwxKPD3QSoKauthVkbqnyNCZMff9JYzfriFE1OxqT6euRvi3So/ISRdFYRsje /TupyYSC+B9hcRkp8JCKW+/k9kshE5eNKew8Y8nCE4aahBtPi0QzbevTlTv0Tt0P7csDTPbN8 VWhYuiUYqQp8TZJeUUe7e5tYd/9DeBjdr0GdIZHdA1WW93eD06QIvbCxB6HbYSoNjQnwzBhqt 4yZfQzezWeXBt0Tj23bHvfrpGzi83E7r3pJIXJ/IuDPRb5Gjx2s0VkBQOoCmZIE33BqMxZYwu 7ur5pQlsl01pEh/E7XeCPLmMBsxzoacbgWunl7PlHRaVOo+U72dMaw6crp6XhWWDs6lYA4DMH YpjrDY/BRb2Hr5v7VOo1MsoPbNVW6W/7rYG1+WYI8Omjnt2+ycrlJuSlHWypdmajLCJyHJKDf kBzTOdWznfM8xjJmXVoEXO8SexgOjx69l+2tu9x8NKseVPfyrBm0fov2L8DNVc6O7GrKVOSBQ HTp4kf+nQsJ5AXapkoE0nxtGPcnJFiispQ9y8LhbpQv5XmEWjfAiBO7kC1aA/I3oOmzwwHVmk CHxEq9K801lUZqulRXmXCODipzuOq4r8YPwlGDTvitRDSRFiBY= 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: Tue, 17 Oct 2017 20:15:17 +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/ps3/mm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index b0f34663b1ae..257de451e324 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c @@ -524,8 +524,7 @@ static int dma_sb_map_pages(struct ps3_dma_region *r, unsigned long phys_addr, int result; struct dma_chunk *c; - c = kzalloc(sizeof(struct dma_chunk), GFP_ATOMIC); - + c = kzalloc(sizeof(*c), GFP_ATOMIC); if (!c) { result = -ENOMEM; goto fail_alloc; @@ -570,8 +569,7 @@ static int dma_ioc0_map_pages(struct ps3_dma_region *r, unsigned long phys_addr, DBG(KERN_ERR "%s: phy=%#lx, lpar%#lx, len=%#lx\n", __func__, phys_addr, ps3_mm_phys_to_lpar(phys_addr), len); - c = kzalloc(sizeof(struct dma_chunk), GFP_ATOMIC); - + c = kzalloc(sizeof(*c), GFP_ATOMIC); if (!c) { result = -ENOMEM; goto fail_alloc;