From patchwork Thu Aug 10 13:02:35 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: 9893703 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 794FE60236 for ; Thu, 10 Aug 2017 13:02:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 661B528AE5 for ; Thu, 10 Aug 2017 13:02:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A1DB28B3A; Thu, 10 Aug 2017 13:02:58 +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 0900F28AE5 for ; Thu, 10 Aug 2017 13:02:56 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 865CF26756C; Thu, 10 Aug 2017 15:02:54 +0200 (CEST) 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 F143326756A; Thu, 10 Aug 2017 15:02:52 +0200 (CEST) Received: from mout.web.de (mout.web.de [212.227.17.12]) by alsa0.perex.cz (Postfix) with ESMTP id DCEE5267572 for ; Thu, 10 Aug 2017 15:02:42 +0200 (CEST) Received: from [192.168.1.2] ([78.49.53.238]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LpwB1-1dAqPS23hn-00fh6c; Thu, 10 Aug 2017 15:02:37 +0200 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Jaroslav Kysela , Liam Girdwood , Mark Brown , Takashi Iwai References: Message-ID: <16fbe262-3b6b-2395-be43-285dc2ff5420@users.sourceforge.net> Date: Thu, 10 Aug 2017 15:02:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:EzQ8bvd6hunNlGm0CNjZjVgQOt0O9lZrR5Wiy85JcSkho+c9lF+ csKVUqXujFOrehaDXjJVHSrEYNbXqnshc0vqr7evYTLKu/EjBUIrWvKIqyG7iOrh43YVK+y XsoYmONkwlSWHmHAL/P27oEJMIisSs62IS7vruIPxlhLDhx7pbbt3U442DoBcv2XKxjWl2c QOUwjzR5FPUHtmlRwVRYw== X-UI-Out-Filterresults: notjunk:1; V01:K0:yDBfDdhczgc=:N4wS7o34eKvl495pmXk2IK +gPz7yNap5hJDozOxI0MtwISajE9x0iUP/H09/3AFs6nsRbiLsVEG//dQy9t+Tn8nMxUBnWll L92e8ncp/9qNbs+9ZDBE6Xr99hmxqT1V2/2fBVlvPZ9cERW4rdkqJPniv0A8Bcma/Gt5OUg+K wXJX9Vj2qbYNdR/Fj3Rp1B0d+vXPxSdesjBt8K81hrVhHuaxPMab92IuJ9m6p98J1+0OaG3Bz xwRlV/NbULt1jqyfiyEfd2EvvL9ir2ktTv3eubQj+5Wl6TU0qJSm1yXiohlA2r93siTsUvlUS VFMY3OHMoPf97noAXj+QAc61o5PULaOM1NdNA7xOyY0oBHTIc1GvK4040eDfffbUC67MoPVFq 4BuDf6pOlvXS4LiQ+YAp+arDG0RtPa5cOuzsS9tuG9xvZqahCsgoBiL0Thsla6MuXcDOx0+Mj /plR95weZQj0gdl5OvUJI0vsJX4wCG/NW3024wuH1YVoxRrlze4wXq22i3AaO3JwBWdJdkB6O uwPdF1oXoyKbRmYh9QJ37tXfnx1ubfjMiwwJZTBFtJ7EoFbEen/tMGClWtDmcyOuDwboNYhLa 5GfJBnyx35SQAarUlNblcW3czt7WV3BUJMbZJ0qa7AzVjDsDvnVXza2/Fyb851E6mNmDyA8nm hmRw/aqWAbUI5gGXU561WM0Z2vH9v7BRXtukWUacIL9Gz4o/AXDZBoanSTbCHpehcoT7dVlng 8CzJ/JKT2IRRWMPMFCGNR3+EvcbHlgv396rC/MtCvH7ppYu7RB7yLPsdiP2xnzFsQq9jqz0wK oNWaeKqH5kdf6k99xXzRbIhLmil26asQv0UQY1X72A2WEX6Nw0= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 2/5] ASoC: dapm: Improve a size determination in two functions 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: Thu, 10 Aug 2017 14:15:47 +0200 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 according to the Linux coding style convention. Signed-off-by: Markus Elfring --- sound/soc/soc-dapm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 3adb914bc009..e673961210e6 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2651,7 +2651,7 @@ static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm, if (ret) return ret; - path = kzalloc(sizeof(struct snd_soc_dapm_path), GFP_KERNEL); + path = kzalloc(sizeof(*path), GFP_KERNEL); if (!path) return -ENOMEM; @@ -3859,10 +3859,9 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card, } kcontrol_dai_link[0].private_value = private_value; /* duplicate kcontrol_dai_link on heap so that memory persists */ - template.kcontrol_news = - devm_kmemdup(card->dev, &kcontrol_dai_link[0], - sizeof(struct snd_kcontrol_new), - GFP_KERNEL); + template.kcontrol_news = devm_kmemdup(card->dev, &kcontrol_dai_link[0], + sizeof(*template.kcontrol_news), + GFP_KERNEL); if (!template.kcontrol_news) { ret = -ENOMEM; goto outfree_private_value;