From patchwork Fri Jan 13 17:21:55 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: 9516073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2317F601E5 for ; Fri, 13 Jan 2017 17:22:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 129AE286E3 for ; Fri, 13 Jan 2017 17:22:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0731C28763; Fri, 13 Jan 2017 17:22:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A35E7286E3 for ; Fri, 13 Jan 2017 17:22:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751113AbdAMRWE (ORCPT ); Fri, 13 Jan 2017 12:22:04 -0500 Received: from mout.web.de ([212.227.17.12]:63330 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750760AbdAMRWC (ORCPT ); Fri, 13 Jan 2017 12:22:02 -0500 Received: from [192.168.1.2] ([78.49.203.248]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MTy9d-1c1WGz2qq9-00Qo5T; Fri, 13 Jan 2017 18:21:56 +0100 Subject: [PATCH 12/17] spi/topcliff-pch: Improve size determinations in pch_spi_probe() To: linux-spi@vger.kernel.org, Mark Brown References: <1413e173-dbac-7a6e-09cb-2287300a335e@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Fri, 13 Jan 2017 18:21:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <1413e173-dbac-7a6e-09cb-2287300a335e@users.sourceforge.net> X-Provags-ID: V03:K0:h8rEbkmwKnp1EllowZqaN2ed0vX2ynJQltW1l3h7uC7ma5VRPGY Ixb0lbI7zbhD1vgUV+wN5E9ZoJaYNtqa7p+phZbJ/UVIXR/cvcumZGlOnuDZJd3VVtaAVWN K4Ndv5CwV89VpAA4ddmt601gIDfbzO+Wj/9o7k4w0CosolZEMI0L/P4zPUh0fJLF0l8zEiM l1iDPgXM465kQLmfU/tnQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:eShGBv/4aig=:0d6NX4Cyx5r+6h0WByn7zw oKZLK9vqCUGTOZNvLn4VGJg8WCeujUwpO/sWUv977RbHbyw47dd6f7jf5LtLaNRj6qQWrDLXl K0WFnRdtf/5tDe2rGql5FUrWxM5QVmD4Nzath6ywOk/Oj2RcS8bs5fBqmORWvziaj1bYPI5EU 5iBZfQi/ILwwWnVzRWUm1cryb/jQgf70QnQSn4VjKW/fglSFa621A5Mce1Ej4YrzPbQ65KDEv ph44EVfKiiODHL5RwUNbLLw40SWBSdkyGtiYT7DUXjuEYXdNAFHV9DMbBkA34EhrFIQnS5uqu kZb8J7oEkIUjNeQ7s8craDGToFRSBUshgpD434jOzwGg1L1gdy1D7fNmv2tB6Pm28ukP+VkRr u3xwJHyUMVCFe/TSEeJ7u5uz64L79nAjlRE8E+gYG8wJqYc5dvKTm9KH1XPGnZV8i9+9I8rbr wtWNh6Ksd26IHDTRX094bRxpFkAe+h2prT5w+Zbq9CppZbcnqcT0JsECE1Io09IJTSP+rzx4+ ulQ1LvX/VwDl17BJI/5YCOd6Qp1T585SVyw77R6vDUGZ5J4GzF0HolskJDH4Wf3foXdDUXyGk Z5vs/Gx68LJLAc0XcIldRULbPrtl9b2HvOWvA77EzBxj+3pZ0Mf1WXqpiLsGTQQN+JfzpTjhK x7UHMzLrveyDOe8ydcEbTr4dDIqEgZ4c41RMsA/IJCLCQEWq3gJgOXswq9oaxXT9P81Y0jY+Q +PjfAoBkER70InE4s2/NNhe+qSyFPds5PBurEeyu9yIvQ+f55tWL3WfzJe90AItyBmcGRpC4k 4MoF+/s Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 13 Jan 2017 15:46:35 +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. Signed-off-by: Markus Elfring --- drivers/spi/spi-topcliff-pch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c index 0488b7c7cc19..4bba39e70c7b 100644 --- a/drivers/spi/spi-topcliff-pch.c +++ b/drivers/spi/spi-topcliff-pch.c @@ -1541,11 +1541,11 @@ static int pch_spi_probe(struct pci_dev *pdev, const struct pci_device_id *id) int i; struct pch_pd_dev_save *pd_dev_save; - pd_dev_save = kzalloc(sizeof(struct pch_pd_dev_save), GFP_KERNEL); + pd_dev_save = kzalloc(sizeof(*pd_dev_save), GFP_KERNEL); if (!pd_dev_save) return -ENOMEM; - board_dat = kzalloc(sizeof(struct pch_spi_board_data), GFP_KERNEL); + board_dat = kzalloc(sizeof(*board_dat), GFP_KERNEL); if (!board_dat) { retval = -ENOMEM; goto err_no_mem;