From patchwork Tue Oct 17 15:40:17 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: 827096 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yGfZq6XFwz9t32 for ; Wed, 18 Oct 2017 02:42:27 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yGfZq5YV9zDrTh for ; Wed, 18 Oct 2017 02:42:27 +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 3yGfXv049hzDrKf for ; Wed, 18 Oct 2017 02:40:46 +1100 (AEDT) Received: from [192.168.1.2] ([92.228.183.125]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M3jsn-1dEAVO3aU5-00rIiY; Tue, 17 Oct 2017 17:40:20 +0200 Subject: [PATCH 3/3] powernv/pci: Improve a size determination in pnv_pci_init_ioda_phb() From: SF Markus Elfring To: linuxppc-dev@lists.ozlabs.org, Alexey Kardashevskiy , Alistair Popple , Benjamin Herrenschmidt , David Gibson , Gavin Shan , Michael Ellerman , Paul Mackerras , Rob Herring , Russell Currey References: <549d0b6b-f875-c524-d867-742745117c1e@users.sourceforge.net> Message-ID: <03b68902-629e-65ab-a5e8-d90a3613f596@users.sourceforge.net> Date: Tue, 17 Oct 2017 17:40:17 +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: <549d0b6b-f875-c524-d867-742745117c1e@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:5k9VhPJNJQIuRzqjeA6xEXvNtD2ZchHg+0Qn3JClNsZ3cCYzGaB zimpin46/ZGk0HdLSJJk+lBwC3XSkoZesMX05WXFX5haSm4jaQQCDiMdzdHI7bqwocwlSkS pb1PrsxM1nm7MbkSmLWitZJDwe+Q/kgjI6yRstsuRSVm1fVQ5oiQnRn7cEdouOJ1ZfjKIGJ tNHd+JTtruisOyiQ2rtxw== X-UI-Out-Filterresults: notjunk:1; V01:K0:l6E1HHqAYps=:ypf7dZCZMS2P9LOsuPJRUh Ra0QJEPnsnLfPzQ4JdniVfuRqty91hingZ93TPgILCmxHXKOEcUADL9pta3YZd8Nq+GmH54l2 WKEf2kUdU5ZjZAYyCzuNtY+mZA86CM3NKLRmOnhHvGycoCcz61yyecq3BcHnPXBTgCPcrtva1 85w+C99KasdkR4+sQzTvw1e4uhB5G6dJMCUmLAyRBy/g+Hz+9NnFGx73AKiSv+voa/0ESQxVK RKATs+lFBq7xhEGW5wXeEGk+T+zB0WipIvwhxN4t0BclPw2biC6SStchfvnjLlxAibN7RfqXy Ei8BJzq9y9j9aVmta244mOTfKYx4XWKnMVBRF+2L0TxAxXT8qtFPcRyiJPsCuQBdw7qXlVePN 2zi+YDkutZ+urmudfr6VD+050ExaEDA2b3xFdSqoCvY5IwgyqTRdbMorLY2Qf98i+76iTp0LM 8hWboXmPzn5L0zkdkIRwZxKbAJd94N0J06Sn+5Yxu5OEp9qChjR+sx4IYXCo0YK3ZPZCRLNnm C6kzIKFRVk0nZwQHobN5xhji6mlpy0F2bDqPUaqJLglSHWWHRmGNuevETuvaCCZcuMFspiio6 wffQ8A7a+wRTboa5cTfW7x6uANJwkd5xYMvoUxswZcynSHTlD18rXQG/Nl0SEX76fTvpJNQrP d6we+fhotqoKTEFQqr9ZGDEkbxAAif3WSpAdIBc3W/eEDuc4bA3NIuIw0Pg4OE9u/TBsHXXQH pW0UtRCheG80Mq3gs+OjocIlamJH9ZX/cazcYetN26+XHSv4cJh0oOWZzRhWjsxUfFpwsFkOY 92LTjFdx+HItRuYOjFWVj4dXBN4wM8raazpBrOa3+g3tnrsYqk= 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 17:18:10 +0200 Replace the specification of a data structure by a pointer dereference 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 Reviewed-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 98d9435240f4..2febdf06a237 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -3802,7 +3802,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, phb_id = be64_to_cpup(prop64); pr_debug(" PHB-ID : 0x%016llx\n", phb_id); - phb = memblock_virt_alloc(sizeof(struct pnv_phb), 0); + phb = memblock_virt_alloc(sizeof(*phb), 0); /* Allocate PCI controller */ phb->hose = hose = pcibios_alloc_controller(np);