From patchwork Wed Nov 22 19:58:28 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: 10070893 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 0E7F760353 for ; Wed, 22 Nov 2017 19:59:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3FA22833E for ; Wed, 22 Nov 2017 19:59:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E785229E33; Wed, 22 Nov 2017 19:59:16 +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 BDE7B2833E for ; Wed, 22 Nov 2017 19:59:15 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id AAABF2677B9; Wed, 22 Nov 2017 20:59:13 +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 698862677BA; Wed, 22 Nov 2017 20:59:12 +0100 (CET) Received: from mout.web.de (mout.web.de [217.72.192.78]) by alsa0.perex.cz (Postfix) with ESMTP id C8F14266F03 for ; Wed, 22 Nov 2017 20:59:10 +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 0LqUXd-1ely2b39ZB-00e2St; Wed, 22 Nov 2017 20:58:33 +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: <521550ca-c13e-e647-5bbe-d8b172a6445b@users.sourceforge.net> Date: Wed, 22 Nov 2017 20:58:28 +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:LGE3b6/bO+6PBGUjbCOkOsMpgseT7HIiWFlCuawo4iX9GrMTITX LbTkMHFKTPPpdRGWvXVa7heIoPcEI3Ga44M3V6vJIUGDfBK0i5+BlDV05I6y5rqtzUoADLM /K814+o+AS9ziMn5uKcBlrGVOX1NLKa6bLnFPhiBkNGV+8uVRhAz9xSs4G5F+XmHPubtJ9G IncrI33a8vMsyHkyRKIXw== X-UI-Out-Filterresults: notjunk:1; V01:K0:IuzICAirW5A=:O47uJc5rNcVOZjy3ZgFvyq 36RQaTrbxvgRlE0pZy3aJsYeZVSJsDTVa5aFz3NESLr/EhdqaQzZ18oS1yrx5t4u2Xfhjv++f vbNVRMRMGGB+eUuBsEZnBnF21qBGP4/W4azYrrkx6mx6ak7NJFkl5CjdCf2o4WSXkLjBLC4r3 WcjpZ93aNTTq2BO0Ws6Iidw7Jvep0iVxLivYrHOoEZumea6IjTI4soCVdEkMWU1uUX+ZgQKR6 j6Z4gigrl3bqozSOFO+E3fe9y6ujkdxjlt04YJiYqINnGXDadjVYT8NvHlh9krPILA7OXM2+d 2LX7y0E70iloZnZoAqVwEdzgGt+QdnpmiBT0ff2c1pg9u15KRer+WyyEVDfnlEx6jozh7vmPP +2EZfHctSWmtHw6ENMa0gxiqDwaYK/8i5FlMxfLyCNuafIR9uh7GvGJHPo5Zp7nOFojmxYVqM coCMCQrT9LzYtEv4YVNATjTPkxGW13nxa8o/TZSGRwOixn+bT1e6A/HXGk334nvhC8C6pjfp0 LD0MmfMw7mizL+4NXG94CxqdTvFFDa27g/1VNUA1G90v84TC11kaqZjB/AFy6iKtQ9I2E8L+n 87PIPpi8EPxrZnCdR7kMpRB5lLwpDZw2yJZyosdGbOchrMr72gxNnZ0h2d2ASij5s4GTZ8Q6k EoVKW/6qwIkGty9CLLI9bHY/D8GGxaBqlwkyqRI1WFJMmfSrLIpiLu/s+3EZIS7zJfikbWRGB Glr+89LtZmYuDX4NzLE5fznK4zi38D0Wcha7wgcVojQ6wvrcepClhIAP8c2AaKhNDfYFtvb/x EUtPDACUAoPdpmJFWw8KJC1Epu1q1m7aDybanhDN6dsH0InYAk= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 2/2] ASoC: cs35l32: Improve two size determinations in cs35l32_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 20:40:47 +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/cs35l32.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/cs35l32.c b/sound/soc/codecs/cs35l32.c index e41d8ebe6eea..bc3a72e4c4ed 100644 --- a/sound/soc/codecs/cs35l32.c +++ b/sound/soc/codecs/cs35l32.c @@ -355,9 +355,7 @@ static int cs35l32_i2c_probe(struct i2c_client *i2c_client, unsigned int devid = 0; unsigned int reg; - - cs35l32 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs35l32_private), - GFP_KERNEL); + cs35l32 = devm_kzalloc(&i2c_client->dev, sizeof(*cs35l32), GFP_KERNEL); if (!cs35l32) return -ENOMEM; @@ -373,9 +371,8 @@ static int cs35l32_i2c_probe(struct i2c_client *i2c_client, if (pdata) { cs35l32->pdata = *pdata; } else { - pdata = devm_kzalloc(&i2c_client->dev, - sizeof(struct cs35l32_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), + GFP_KERNEL); if (!pdata) return -ENOMEM;