Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1342201pxp; Sat, 12 Mar 2022 07:50:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdKsWSTZWbcNPdda3sfs0eVYbqHBkvvqGaYW44gW9sluUTWLdwRB/VHO6gFRFxJM9HA1jo X-Received: by 2002:a17:906:2bd7:b0:6cd:f89d:c828 with SMTP id n23-20020a1709062bd700b006cdf89dc828mr13114767ejg.232.1647100201661; Sat, 12 Mar 2022 07:50:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647100201; cv=none; d=google.com; s=arc-20160816; b=ir7VJ5KDaLgSrjIRXfyHCwZN3zWseQ0agyjXyAoPRSwCe/C9huwyf8jekEyWQFiIw2 T0HPfKgREnsK6idiObGo4qu8+hdMKBny/zJyiZZihzGzy4G9E+r6XDBV+Niq1duBLqXs ynjQcH+Ba1kJKy2Mbn77YXPXI2qwZ/xxU+wwQfgOGT8MJgB2WPESQEcFOEe6MQzcX/Zi 4RsHygO1Wt3OwEjp2ehEKS1iIsjHZGJR7cr9GJG8RSxba6wifVfBIQU4PvJb/2anWUTH 3RUgKKAK7WvCzuEbk0NKLy18xUY9v7j/LBbggI02CcRIXnOoBTJgBcg/GqIEaD584guq SrHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C9vAruW4R//FRSIjiNqYU6Ft3MliOnywc0sb41/n6xw=; b=tGk+xTxGpf9JJ5MujSPm7AuuJ2vEGY3kXk2L6734g42YpdkRifjXvPsUMwuGWckMq9 ITyLqTyc7i38xv21IBsSwPn3hc45cR8ORS0cb5sdbmU9lRS2/VsxXyOlKLYVKLRVoewU 8M6NrmERO9G5yUabZoN9ISVx2mMvPhSS8P4iAypg+Xk2S7p86jKqwInrcC0rb1AVR364 1I29ujyaxj6IxMV/tvwgp7ej2jydnm8HdC4uxbHACfwEy8kd1eaq4iScr0+aRfunk8tB ez+GuzfSiEPBL+xn/Oe5BfOFi1TPmXFaY2egpnSu0Os6A17/Td8qt2IYv4xIJc2h3Pla CxDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=u0u3uhQk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t13-20020a056402524d00b004166306f239si7076034edd.198.2022.03.12.07.49.28; Sat, 12 Mar 2022 07:50:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=u0u3uhQk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231764AbiCLK2h (ORCPT + 99 others); Sat, 12 Mar 2022 05:28:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231738AbiCLK2X (ORCPT ); Sat, 12 Mar 2022 05:28:23 -0500 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DCBE1E6951; Sat, 12 Mar 2022 02:27:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C9vAruW4R//FRSIjiNqYU6Ft3MliOnywc0sb41/n6xw=; b=u0u3uhQkEIH037bzpmf6fonLaHE3/dSzkg9XXqDTu8x2VuKpLdMHbZqB tLzEawUQRv83wyBHcwa56iojCwJmeRdfcyETYat3e47YCG2zQ38fZVfqh XwGnl4PVBwaqecMy6IEwUSiduSNVbB6WOYP8tIqbe53jquEVQeJuR82cc s=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="5.90,175,1643670000"; d="scan'208";a="25781349" Received: from i80.paris.inria.fr (HELO i80.paris.inria.fr.) ([128.93.90.48]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2022 11:27:11 +0100 From: Julia Lawall To: Jaroslav Kysela Cc: kernel-janitors@vger.kernel.org, Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] ALSA: seq: oss: use kzalloc Date: Sat, 12 Mar 2022 11:27:02 +0100 Message-Id: <20220312102705.71413-4-Julia.Lawall@inria.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220312102705.71413-1-Julia.Lawall@inria.fr> References: <20220312102705.71413-1-Julia.Lawall@inria.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use kzalloc instead of kmalloc + memset. The semantic patch that makes this change is: (https://coccinelle.gitlabpages.inria.fr/website/) // @@ expression res, size, flag; @@ - res = kmalloc(size, flag); + res = kzalloc(size, flag); ... - memset(res, 0, size); // Signed-off-by: Julia Lawall --- sound/core/seq/oss/seq_oss_init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c index 0ee4a5081fd6..04a3376a6e66 100644 --- a/sound/core/seq/oss/seq_oss_init.c +++ b/sound/core/seq/oss/seq_oss_init.c @@ -66,7 +66,7 @@ snd_seq_oss_create_client(void) struct snd_seq_port_info *port; struct snd_seq_port_callback port_callback; - port = kmalloc(sizeof(*port), GFP_KERNEL); + port = kzalloc(sizeof(*port), GFP_KERNEL); if (!port) { rc = -ENOMEM; goto __error; @@ -81,7 +81,6 @@ snd_seq_oss_create_client(void) system_client = rc; /* create annoucement receiver port */ - memset(port, 0, sizeof(*port)); strcpy(port->name, "Receiver"); port->addr.client = system_client; port->capability = SNDRV_SEQ_PORT_CAP_WRITE; /* receive only */