From patchwork Fri Oct 24 15:01:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 5148241 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 7F3999F349 for ; Fri, 24 Oct 2014 15:04:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC8E92018E for ; Fri, 24 Oct 2014 15:04:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7D0CC2025B for ; Fri, 24 Oct 2014 15:04:03 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6E47A2605BB; Fri, 24 Oct 2014 17:04:02 +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 6DC4C2604EA; Fri, 24 Oct 2014 17:03:21 +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 0AFAC2604CA; Fri, 24 Oct 2014 17:03:20 +0200 (CEST) Received: from mail-yh0-f49.google.com (mail-yh0-f49.google.com [209.85.213.49]) by alsa0.perex.cz (Postfix) with ESMTP id EF5282604A7 for ; Fri, 24 Oct 2014 17:03:12 +0200 (CEST) Received: by mail-yh0-f49.google.com with SMTP id a41so935137yho.22 for ; Fri, 24 Oct 2014 08:03:12 -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:in-reply-to:references; bh=URMNhjI9gKyUkHLVOThh7niOw2LJfjwcsy5L1JKE2i0=; b=oJjHbJTuKUrcEfncGkFSSlqV7FpYqhS46UrzMmdS2sw8qevjEMj9+SCkQryZhwDAmC CknK/+sp9QH1T9hvLxSBQDLLm6evEFLlzB8Rv3D+D/I2h2QEzvKdg9a0PdNMApxkVT/+ /SCKYJhgFR3npiVg8mG4fIAJjHVSFGfElTEwRzKFQ6as2kE1+lXGYO/qw9acaqYozTYI KBvCgJcobDjm1i/AJVoIZ722vaeEaP/Upy2gqYPFYOCPKCg5foruFNa69G5+9otp5/jg YpnLFXPBgD2v1NNKXybdOiR+uGrmPWLfKsflsxXL+pQ3q2dJFWFbX4uq+Y374iNevWKF 5ovA== X-Received: by 10.236.11.103 with SMTP id 67mr5929738yhw.74.1414162992260; Fri, 24 Oct 2014 08:03:12 -0700 (PDT) Received: from localhost.localdomain ([201.82.52.106]) by mx.google.com with ESMTPSA id m9sm2171084yhm.24.2014.10.24.08.03.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Oct 2014 08:03:10 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Date: Fri, 24 Oct 2014 13:01:27 -0200 Message-Id: <1414162887-14279-3-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1414162887-14279-1-git-send-email-festevam@gmail.com> References: <1414162887-14279-1-git-send-email-festevam@gmail.com> Cc: Fabio Estevam , alsa-devel@alsa-project.org, Charles Keepax Subject: [alsa-devel] [PATCH 3/3] ASoC: wm8731: 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. Cc: Charles Keepax Signed-off-by: Fabio Estevam Acked-by: Charles Keepax --- sound/soc/codecs/wm8731.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index eebb328..2c9f2a7 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c @@ -680,8 +680,7 @@ static int wm8731_spi_probe(struct spi_device *spi) struct wm8731_priv *wm8731; int ret; - wm8731 = devm_kzalloc(&spi->dev, sizeof(struct wm8731_priv), - GFP_KERNEL); + wm8731 = devm_kzalloc(&spi->dev, sizeof(*wm8731), GFP_KERNEL); if (wm8731 == NULL) return -ENOMEM;