From patchwork Fri Oct 24 15:01:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 5148231 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0F7019F349 for ; Fri, 24 Oct 2014 15:03:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1049B20279 for ; Fri, 24 Oct 2014 15:03:34 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 2FBAA201FE for ; Fri, 24 Oct 2014 15:03:32 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1C94E26056D; Fri, 24 Oct 2014 17:03:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id C7DE12604AA; Fri, 24 Oct 2014 17:03:20 +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 C30F52604CA; Fri, 24 Oct 2014 17:03:17 +0200 (CEST) Received: from mail-yh0-f41.google.com (mail-yh0-f41.google.com [209.85.213.41]) by alsa0.perex.cz (Postfix) with ESMTP id 916C82604AA for ; Fri, 24 Oct 2014 17:03:09 +0200 (CEST) Received: by mail-yh0-f41.google.com with SMTP id i57so863008yha.14 for ; Fri, 24 Oct 2014 08:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=JrTUreUiYdDijP/vNExD3PX17oGgXTozsPD/tJH8S84=; b=I0/aNEl1blgKmCM4mv5DXLqMRFG2dL54jkXbE53LWi3NvPoEYdAR6Wtn9JIez9AnxM 5mZUO78yHe/vwcNm0rT/pCsatDLzfrg4K3mQzJRtzKRXNUjhrEK7rq0Pba3KiXV05ai4 9fvAdZLNVR6A/H/4NtHHdixiRiqFOKHhKti6kv/bR4BOl2cn5xhaQeXft6k7cCRuRYAK 4rsHBE/1hfNBBZyhcRTLT7brt2SyK8lZsrrX12aedSnNuYUu+CoCvXaq4w3TBh/NskHI ZtOQGDir/JsDWNlBUInVOQSc1Nsj/MivKUp7wxG3uxHjr8Kfxx2uPhCAqE1eLaJfqX4A +Tdg== X-Received: by 10.170.139.86 with SMTP id g83mr7373762ykc.96.1414162986577; Fri, 24 Oct 2014 08:03:06 -0700 (PDT) Received: from localhost.localdomain ([201.82.52.106]) by mx.google.com with ESMTPSA id m9sm2171084yhm.24.2014.10.24.08.03.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Oct 2014 08:03:05 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Date: Fri, 24 Oct 2014 13:01:25 -0200 Message-Id: <1414162887-14279-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: Fabio Estevam , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 1/3] ASoC: sgtl5000: Use the preferred form for passing a size of a struct 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam According to Documentation/CodingStyle - Chapter 14: "The preferred form for passing a size of a struct is the following: p = kmalloc(sizeof(*p), ...); The alternative form where struct name is spelled out hurts readability and introduces an opportunity for a bug when the pointer variable type is changed but the corresponding sizeof that is passed to a memory allocator is not." So do it as recommeded. Signed-off-by: Fabio Estevam --- sound/soc/codecs/sgtl5000.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 6bb77d7..3f8c05b 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1419,8 +1419,7 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, int ret, reg, rev; unsigned int mclk; - sgtl5000 = devm_kzalloc(&client->dev, sizeof(struct sgtl5000_priv), - GFP_KERNEL); + sgtl5000 = devm_kzalloc(&client->dev, sizeof(*sgtl5000), GFP_KERNEL); if (!sgtl5000) return -ENOMEM;