From patchwork Wed Nov 22 20:30:22 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: 10070913 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 3D883601D5 for ; Wed, 22 Nov 2017 20:30:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3025D29C1C for ; Wed, 22 Nov 2017 20:30:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 253F129DCC; Wed, 22 Nov 2017 20:30:40 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BF1A29C1C for ; Wed, 22 Nov 2017 20:30:39 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 06AAD2677C8; Wed, 22 Nov 2017 21:30:38 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 800D82677C9; Wed, 22 Nov 2017 21:30:37 +0100 (CET) Received: from mout.web.de (mout.web.de [212.227.17.11]) by alsa0.perex.cz (Postfix) with ESMTP id DE5F7266F03 for ; Wed, 22 Nov 2017 21:30:35 +0100 (CET) Received: from [192.168.1.3] ([78.48.197.157]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LecRm-1ewidg1PUU-00qRGl; Wed, 22 Nov 2017 21:30:26 +0100 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Brian Austin , Jaroslav Kysela , Liam Girdwood , Mark Brown , Paul Handrigan , Takashi Iwai References: Message-ID: <044cfc92-158f-3bff-a2e6-4993a9070e13@users.sourceforge.net> Date: Wed, 22 Nov 2017 21:30:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:dYqnF0F24hrLfDZA3EMrsulk9MnfcEUHDx9C2VSYROX3ZxVA/4+ d0C1zhdw/9AO+YAmiivg66bVW4XNOtb0W9/05cmY7UaIvukO4vzw6CHbp76nzru61abjSOr mXDsxzQkdZSjVih2eODzW+hen+qxBUCafS71Kaat9Q1QIXEWtK7dkwGq529p8tEWhqkgm+c +21a+mi00UaMWtrjnvTFA== X-UI-Out-Filterresults: notjunk:1; V01:K0:sHwC2Fo2F2E=:E6PKqS8GpX4G1UoOSBeAc9 brHQ4PIZPP1ka2D49FzthMUj7YjLxK7rz4Jy/LFt89CtICNlyg6R81wTQ3shRR/nL0mZw7OjR Hbs6s16xhJw/CBJt+sXKPg5CNL6Z8LZTkQZ753OULWDNcfPaBbLRB2QL8le4SpCvfhDtNlDAn f+ShSeUcEa5dtq0eVmnF19G8jrUYrNu0IismuFQZXWMRyS5Jx3LCOFBBhqOuqW8m6EQKYkLjT P/qtDqhEY6JHbOXrXGcqW2rolQW/AmZfxL0MYjSxBscA4UyujFvRMBFWQiYZSD4z3Wxr02TRe iie3OYWtvZhkto+6T+gzGyEZcQ00w+oJOTho9UtyvIhNrkhqPbq7dM3/FVaJFXy0UpUiX+7Ec hAcsaTApG+fjcC9Hpv6FUT8ZuhhszbEtejv+wz1HU9Chc8OV2yAWe4NYqj32JIVDmpQgbKZEX dhzhbpz20imHxStB2PnOipwWK5Z9lk4iFc+88NXTbcdQY90MKy1yFAHQG7efXUs5vUvTkYWHU b61Ffw0rTlKdQB2ucn7pupRPYDkkADRHD41Wmsl5bweJPkEgx+65Rp7zgtDXBvcDd39HcnTrq bTcPILLr8GuXmMn1NXTBJOU77Vs3jAcJ2vOjGr5BsugOMtK0UmCMsqEcLIvBvMcH5e/g8Dg2Y xKx1z3E5a/tBHMg7zTt9M++l7kbYHth/1JA0thDKNY6vKibynu9ANorZKdolAmwlcMIFauTn8 uqHmIvq5E7scEVwSa9NsAKZKFp2bxvEa6fXwmJ/V3amhJEiZ2ZqRHac5SUhIeGbmg/YYYUl7t ZQ6BEETu9MJJKpszTiv/PNjcYEtsSuhPh9kQhhKOEIxU0gKg1I= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 2/2] ASoC: cs35l34: Improve two size determinations in cs35l34_i2c_probe() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 22 Nov 2017 21:17:42 +0100 Replace the specification of two 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 --- sound/soc/codecs/cs35l34.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/cs35l34.c b/sound/soc/codecs/cs35l34.c index 6cbdbbe53940..0600d5264c4c 100644 --- a/sound/soc/codecs/cs35l34.c +++ b/sound/soc/codecs/cs35l34.c @@ -1004,9 +1004,7 @@ static int cs35l34_i2c_probe(struct i2c_client *i2c_client, unsigned int devid = 0; unsigned int reg; - cs35l34 = devm_kzalloc(&i2c_client->dev, - sizeof(struct cs35l34_private), - GFP_KERNEL); + cs35l34 = devm_kzalloc(&i2c_client->dev, sizeof(*cs35l34), GFP_KERNEL); if (!cs35l34) return -ENOMEM; @@ -1042,9 +1040,8 @@ static int cs35l34_i2c_probe(struct i2c_client *i2c_client, if (pdata) { cs35l34->pdata = *pdata; } else { - pdata = devm_kzalloc(&i2c_client->dev, - sizeof(struct cs35l34_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), + GFP_KERNEL); if (!pdata) return -ENOMEM;