From patchwork Wed Nov 22 21:23:41 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: 10071217 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 87C6960353 for ; Wed, 22 Nov 2017 21:24:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 791D529DA4 for ; Wed, 22 Nov 2017 21:24:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DD5D29DB9; Wed, 22 Nov 2017 21:24:27 +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 BCD0829DA4 for ; Wed, 22 Nov 2017 21:24:26 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 943E12677D2; Wed, 22 Nov 2017 22:24:25 +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 2B9602677D3; Wed, 22 Nov 2017 22:24:25 +0100 (CET) Received: from mout.web.de (mout.web.de [212.227.17.11]) by alsa0.perex.cz (Postfix) with ESMTP id 8A498266F03 for ; Wed, 22 Nov 2017 22:24:23 +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 0LudP2-1fGyTQ0Ptg-00zqdG; Wed, 22 Nov 2017 22:23:44 +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: Date: Wed, 22 Nov 2017 22:23:41 +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:NHdHkkw4mseaBylpaZGWq3mRVm2RaJoHSswp6syQz2FqQRIl8SP RMhKPXU2T8NohC4Mw1GpIxZhQ6hzeRJNVqU0wzrjPtCJwuK0TUqi7FXeJf1mlrB7RV+gs6u lxfL5ayMW59no954Eb5TDyO55MI0535Jlrtb26zS3To2L1jcDdJBmN5tdeDpASeR5NVIPcl 0A5SiOyCCBYAA78CzwsFA== X-UI-Out-Filterresults: notjunk:1; V01:K0:uyPx1Xkf2MQ=:9cYOrxztHTOlMB5pQEgh1L unmQaYXA8av0qF6W1Xy4emF+vf5SaKlh0CC8M6t0A/51FOzKVqoI06P3tO72MJJoN++YbE9yT MGooSLk0gvrFZBio9Pg6/KYNkEc2Xz1tCu7hLPVoUqQpqt5Dv1+FakmR3qfvixLPPlHJXSy6U S9RKy1ctXEmZn/nEqZe1wj4KihOxwIskzgq/v2JNv47C2rhGABYK6568JyXxrGR3XZRaKoIEl 8gIe1RXW9ga8zg4o6PDEaGh/hgdhpo1oMxd+imG8UGAhVW3z9UVCjCJOR3jajGVf5vaY0052Z pBOMp6cJQyAGdPGDWkrdysS19dIeoiNzEztCY1lono+YIpZMP2wKH+0JyNpexpeGzZwpGuaL6 SEfNVzyvPfPFWf1xtdS0cbuHAVqwKnmIe11SGjPVB1NPIl8mWLHbqdg+9tDPdwkF/Ul09mLnT yluQYVyBV0tTqWOl3Ar2Hot66ZthFFMIl4SZpnwHeFAsLL4AVztHSICyBRcxhE5h1imPPLWC1 gsSlMm8hHUMSeFl6zmAC1bjnWfkw/NxYnMbHYgtK6yVlo4xYdidXjR9DwO2AoNvz7wfCVx4eQ qWkQ6yPXLaGyb/Q82ppMDOL9czWoz3e6X+Q+LmqetTJyfOV61DVME59auoxSsBwgfRWaa2rDB aVV+g4GBKA84btzFKCL4ftKYljZGs7PcAm92eHOPzXt0FuxTESF0eBDhpmxido9M+5UFHQ4Nt hBBL8Ani+ys8h45GF90pd9WT3ULS6hZmfjf5DgT7L5dwmQL7LZwBIg2q7sM1dYSOloldH5Zrm c7tn+ccE2sKDFgNbYPuvAFaXDiG4pg/JuCMue6SYxtMNWId7h8= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 2/2] ASoC: cs42l52: Improve two size determinations in cs42l52_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 22:11:30 +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/cs42l52.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index e8645f2ac0d9..9731e5dff291 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c @@ -1100,8 +1100,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client, unsigned int reg; u32 val32; - cs42l52 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l52_private), - GFP_KERNEL); + cs42l52 = devm_kzalloc(&i2c_client->dev, sizeof(*cs42l52), GFP_KERNEL); if (cs42l52 == NULL) return -ENOMEM; cs42l52->dev = &i2c_client->dev; @@ -1115,9 +1114,8 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client, if (pdata) { cs42l52->pdata = *pdata; } else { - pdata = devm_kzalloc(&i2c_client->dev, - sizeof(struct cs42l52_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), + GFP_KERNEL); if (!pdata) return -ENOMEM;