From patchwork Wed Nov 22 15:49:29 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: 10070619 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 38AD9601D5 for ; Wed, 22 Nov 2017 15:49:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A47329C50 for ; Wed, 22 Nov 2017 15:49:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EC6529C9B; Wed, 22 Nov 2017 15:49:45 +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 68AFA29C2D for ; Wed, 22 Nov 2017 15:49:44 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2FC2726778A; Wed, 22 Nov 2017 16:49:43 +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 87C6026778C; Wed, 22 Nov 2017 16:49:42 +0100 (CET) Received: from mout.web.de (mout.web.de [212.227.17.12]) by alsa0.perex.cz (Postfix) with ESMTP id F290B266F03 for ; Wed, 22 Nov 2017 16:49:40 +0100 (CET) Received: from [192.168.1.3] ([78.48.197.157]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LjJPH-1erxci1Nwl-00dWyr; Wed, 22 Nov 2017 16:49:31 +0100 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Brian Austin , Jaroslav Kysela , Liam Girdwood , Mark Brown , Paul Handrigan , Takashi Iwai References: <609e2542-4750-fe60-4f42-08bca79bfb56@users.sourceforge.net> Message-ID: <7229b291-d1e3-6269-4c68-435bbdffb0fd@users.sourceforge.net> Date: Wed, 22 Nov 2017 16:49:29 +0100 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: <609e2542-4750-fe60-4f42-08bca79bfb56@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:muTGR72hCiSB9UYPTIK/5TawrWq0N7isZxU2xR4Pq5N8NtdgsT1 exTkUs4wqz4E+/UEgibP6TrQG0BhfVDOxCFgitVm/Fuf8aQIqkZNmqtjenH5dF7ksG63zGU jTxLasYl6SqvQ9wuaFmXZb8/F3iSoVQ+ppiaVMRgFitdDJOWocb/jRR6zxj9bM3SOy2TtVl aZz5gvp3qLsWY7oaB72cg== X-UI-Out-Filterresults: notjunk:1; V01:K0:VivJhIbpztY=:4Np56tCPB3VJBGrjMObtcI po2cIEV1Bsg+lSEnHCplMDIdOb4J2dVUgUyDGoeMFJeMBEiCO7GpUDfHR46eADyyZ66glBNUh V7upvnQpc0xcDa0QlqxYrMjLFA1d2N0CQ7RxTv3u1+Ko9cxKnB8U5j9/6FQgohSCqIn+fPrqx CQJccyGECqiDU7OvnmDmkr7icLScKIAVqDkRO9P6JRVfdsJYkTxpuUJvkNmH910I/7OiYAMpZ xjRf3Q0JVlOiKe/1+ibEqS0tqHZU2Kb3obqvjEB5Kx+qiVmZi4SmhbuslM8ascqA+1pjynFPg X7onJFOVGTS6eUo04nz+fXp0acS7LLeR6XUaj8UDfjXI4v5ou4NHldo847PU9HZ3ILIeH8rNU LmsdLqwZrV01BgXau1wvEoi8lrP3AjaH1DOXshNjoqUAFv8yae44azy+LoXZrYaXkhwG7jHtG mc+P+gxagJBC6pT0DbBfNyzJWvlk3m4QniNLIQamdyQE5Td1doSAWLSiKF9JiEMlKZ9IBzuox kNwMWiICO9uQaQJFr9i45/cJMghxTGmJWu03I2tNV4Ld4SZ+eYccPVAPn+RVTwjux2G1GiYna ILQEE7jtl66PS/yHq1RkKmHXc3oK2Xbz9QG6NfSpXOhl1m/ZNPc3ySjIA16TmWdzOpp4t0NgP MgNDlDNbEW1VAgfoOc6knK4IDWRMEnl27n8x5q4qQq6rJ+RX/FV71Jf4pHc+C3G7+6IvxWhYc /AD2ZEb84MaGC5d8Qza7bBN0NfJ2pxq430ywTvjaYP2RcQejnP1jCjiTXF+a9O8Ju8dgGKhqP 6IGZnyI7nbMPIrsansOiCe9fP8ErVaDN+7OTmZ2h6xD8+FTq8M= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 2/3] ASoC: cs42l73: Improve two size determinations in cs42l73_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 16:07: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/cs42l73.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 978cfbbad408..dde37e569ade 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -1289,8 +1289,7 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client, unsigned int reg; u32 val32; - cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private), - GFP_KERNEL); + cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(*cs42l73), GFP_KERNEL); if (!cs42l73) return -ENOMEM; @@ -1304,9 +1303,8 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client, if (pdata) { cs42l73->pdata = *pdata; } else { - pdata = devm_kzalloc(&i2c_client->dev, - sizeof(struct cs42l73_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), + GFP_KERNEL); if (!pdata) return -ENOMEM;