From patchwork Fri Mar 14 14:38:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ethan Carter Edwards X-Patchwork-Id: 14016962 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10B34201039; Fri, 14 Mar 2025 14:38:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741963121; cv=none; b=V+iHlW58sWSRcQ9Sv1me5JQ8tfHvsGNzQvzxfbtJTB/g69kx/0/zjjZ728k+vMaR6qW5+6E9Bl0qMbCO0vAXbVvxf6IPlcVB1v989fN2x6TSCbMbBSFVh609APi454Tk6w+XPqdqMmL5jlqBjA8/duzxO6OV0hqDf5qchgtzsZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741963121; c=relaxed/simple; bh=4WckUOYyQY/RdQok8aGOoPfgvFFYolrTAwyfbyQDbIA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KSDlXIOKYtms6RMmasuR5vbsBqsPFi/6EV8VxIdKRECLifLs2s7OelnK+o+V0d276N1FO8JoFT55rL3MTy2frcpndEFnWL1aDDxWM+7D6oSy7Fl9JoD0tpCK+gRnAz6dg0zOmj4C2EElDrUWsWjyL+1fO6lLRhD+9HnofHEQPBM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ethancedwards.com; spf=pass smtp.mailfrom=ethancedwards.com; dkim=pass (2048-bit key) header.d=ethancedwards.com header.i=@ethancedwards.com header.b=KPGmkaiC; arc=none smtp.client-ip=80.241.56.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ethancedwards.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ethancedwards.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ethancedwards.com header.i=@ethancedwards.com header.b="KPGmkaiC" Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4ZDn6d4FTxz9sjc; Fri, 14 Mar 2025 15:38:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ethancedwards.com; s=MBO0001; t=1741963113; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vrlHEmXLbXdlgx3WU/q+bI3S8gXBs468bcs9JBOUOTw=; b=KPGmkaiCOtq5AcadpoDge8cGrWXC0a1VvcNoYE8BAF9/kYeggqpeSm5MpzoWh4P62TylFz yfcJ9Lcwfe4iYqFe/R620oBHTxD0RasdpAluAJScahaUPZNI3bpfVFlmYLiIeqQcQAsHIb /JvW71uyJVpOtIau4eatLqgQBZrqKgEs92vbwZo5cY91qHu55k83CYWM4JEkd7J5Ckj6hC 4kS5/EIXx4hsyeAVWeh2TwgMotujkHmWeW6UfCF03lbx1a0S5zKTB8KWsZq6mD7bxCWABs C25WTXw+EWsT6Dt5FLX7zJdTDBL/sBXPoFbPXXazmARCMQGpNC4ZJHNZK3Mjfw== From: Ethan Carter Edwards Date: Fri, 14 Mar 2025 10:38:21 -0400 Subject: [PATCH 1/4] ASoC: Intel: avs: move devm_kzalloc(..., size * n, ...) to devm_kcalloc Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250314-sound-avs-kcalloc-v1-1-985f2734c020@ethancedwards.com> References: <20250314-sound-avs-kcalloc-v1-0-985f2734c020@ethancedwards.com> In-Reply-To: <20250314-sound-avs-kcalloc-v1-0-985f2734c020@ethancedwards.com> To: Cezary Rojewski , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Pierre-Louis Bossart , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: gustavoars@kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Ethan Carter Edwards X-Developer-Signature: v=1; a=openpgp-sha256; l=1036; i=ethan@ethancedwards.com; h=from:subject:message-id; bh=4WckUOYyQY/RdQok8aGOoPfgvFFYolrTAwyfbyQDbIA=; b=LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgpvd0o0bkp2QXk4ekFKWGJEOXFoNThlVGp6e GhQcXlVeHBGK3hUd2dKdmVXMnoyYlBqVGxIVDhadDg3VDJxNGdYCkwzYThlbmlqZ2Q5RnppdGEw bzBkSlN3TVlsd01zbUtLTFA5emxOTWVhczVRMlBuWHBRbG1EaXNUeUJBR0xrNEIKbU1pYlhJWi9 lbnhicHUyMlhIKzJUYmhGd0h5U3NndmpoMDFIZit0WisvNlYyeDRVdVB5dk5jTTNqVFVUcnI5bg pORlphdktGMHZmM3ZlMWRzeW45TVllenBFZnlaNW1URStKQVBBTzRPVEVrPQo9Umd5KwotLS0tL UVORCBQR1AgTUVTU0FHRS0tLS0tCg== X-Developer-Key: i=ethan@ethancedwards.com; a=openpgp; fpr=2E51F61839D1FA947A7300C234C04305D581DBFE Open coded arithmetic in allocator arguments is discouraged. Helper functions like kcalloc or, in this case, devm_kcalloc are preferred. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments Signed-off-by: Ethan Carter Edwards --- sound/soc/intel/avs/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c index 4bfbcb5a5ae8aff5a981389e61afb3c72b07b15c..dac463390da135d7972808cb55e1c2866dd736c7 100644 --- a/sound/soc/intel/avs/pcm.c +++ b/sound/soc/intel/avs/pcm.c @@ -1380,7 +1380,7 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l for_each_set_bit(i, &port_mask, ssp_count) cpu_count += hweight_long(tdms[i]); - cpus = devm_kzalloc(adev->dev, sizeof(*cpus) * cpu_count, GFP_KERNEL); + cpus = devm_kcalloc(adev->dev, cpu_count, sizeof(*cpus), GFP_KERNEL); if (!cpus) return -ENOMEM; From patchwork Fri Mar 14 14:38:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ethan Carter Edwards X-Patchwork-Id: 14016966 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8731F201032; Fri, 14 Mar 2025 14:38:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741963133; cv=none; b=sH86jOCfQNgte5tcgmGd8snHkcXUsrLgSnrSPlvywm0Wj0IA4LXFkQWioKCOZpWbm9VDz3KG5zZ7ugc9uajfoMVm4j34XI7LpUHQHhmVvPT/Ec8UjdTY911qn2af2YhMHZdmYrgC3bylT2a7RO/wtbwJswaqdK64b/wwZeoPqwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741963133; c=relaxed/simple; bh=HJCET7mgulLHspf8Gs5iMvlePcTNhhZdDgqmCsIb31g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qzJrGwDrFieEtkm1AR1Rsxt63OPIJoVINPr3V5uJrNVY9OyYt4Th0a5dOE1ovPaPyGu2J76Fz2c2iQiw4KgO0TNj6VOmWUC48lC0Swt/9tkSp9mhxrdiooMeeaTCTLIvqgBMI635M8w3cajZhiWai+G9afc4yKyxdixSCb4d6Kg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ethancedwards.com; spf=pass smtp.mailfrom=ethancedwards.com; dkim=pass (2048-bit key) header.d=ethancedwards.com header.i=@ethancedwards.com header.b=SJWo0IRt; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ethancedwards.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ethancedwards.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ethancedwards.com header.i=@ethancedwards.com header.b="SJWo0IRt" Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4ZDn6j4Kn6z9t1F; Fri, 14 Mar 2025 15:38:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ethancedwards.com; s=MBO0001; t=1741963117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IbP/x9WUX07vvJ4O8R+Y29AUaRRBKVspNcjX165mDgw=; b=SJWo0IRtWizU4CfG2vojgF5L3kf3R5YbjsOfWreH7iUT2cDJtFK03zctqnR7TnPV0bPHH1 X46MMMeepwjYG9Q+7QSpXv9rwH+XidRVblTNs2fqxYUBDP66qjBucSgnF/uk4serwx7Jlt RumIe5M6C9orIX4ZsgXTx7r3iA1BSz5BCbBubMO+NpsMPWDWlQe2OPRju6Y0sQL63nvOmB TteuiIyZp1Fc6e3J/l8lUcODCgMnpdtxlbDlivk+MRcuocq82Y8AZzesTKmcmqIOdCyC+c ZUjuR35zkqQ4+S3hYcmGsWV54JNL2BTiEIEyNfhxP1aEyEZCyXkHMeDT2IqKQw== From: Ethan Carter Edwards Date: Fri, 14 Mar 2025 10:38:22 -0400 Subject: [PATCH 2/4] ASoC: Intel: ssm4567: move devm_kzalloc(..., size * n, ...) to devm_kcalloc Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250314-sound-avs-kcalloc-v1-2-985f2734c020@ethancedwards.com> References: <20250314-sound-avs-kcalloc-v1-0-985f2734c020@ethancedwards.com> In-Reply-To: <20250314-sound-avs-kcalloc-v1-0-985f2734c020@ethancedwards.com> To: Cezary Rojewski , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Pierre-Louis Bossart , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: gustavoars@kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Ethan Carter Edwards X-Developer-Signature: v=1; a=openpgp-sha256; l=1196; i=ethan@ethancedwards.com; h=from:subject:message-id; bh=HJCET7mgulLHspf8Gs5iMvlePcTNhhZdDgqmCsIb31g=; b=LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgpvd0o0bkp2QXk4ekFKWGJEOXFoNThlVGp6e GhQcXlVeHBGK3hUNUNQYnBYaUVaZ3o3Kzh0b2R2Tk9qZGFibVV0CmE3dVZ3bDJVdERsME51ZGVD OWVPVWhZR01TNEdXVEZGbHY4NXlta1BOV2NvN1B6cjBnUXpoNVVKWkFnREY2Y0EKVEVUckxzTi9 qdzBtbTR1TTUrV2VLTDlvRWFRVXJmcHJqZmNMYldlaEpoMGVxdzNNL1ZLUEdmNm55T1F0ZVYvMQ pNdEpNOWFLN3lhRTE4NnM5YXVZRS9QWGN2VVAweFUzSlNWNDhBSXdqU3FNPQo9R2RBZgotLS0tL UVORCBQR1AgTUVTU0FHRS0tLS0tCg== X-Developer-Key: i=ethan@ethancedwards.com; a=openpgp; fpr=2E51F61839D1FA947A7300C234C04305D581DBFE Open coded arithmetic in allocator arguments is discouraged. Helper functions like kcalloc or, in this case, devm_kcalloc are preferred. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments Signed-off-by: Ethan Carter Edwards --- sound/soc/intel/avs/boards/ssm4567.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/avs/boards/ssm4567.c b/sound/soc/intel/avs/boards/ssm4567.c index c9d89bfe7178cd6acba0797c56e56462d7c41d8d..7667790d52739b98b97d2bc9fc9496da82affef1 100644 --- a/sound/soc/intel/avs/boards/ssm4567.c +++ b/sound/soc/intel/avs/boards/ssm4567.c @@ -97,7 +97,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs) * 2, GFP_KERNEL); + dl->codecs = devm_kcalloc(dev, 2, sizeof(*dl->codecs), GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; From patchwork Fri Mar 14 14:38:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ethan Carter Edwards X-Patchwork-Id: 14016965 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67EA3202988; Fri, 14 Mar 2025 14:38:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741963133; cv=none; b=dKmPOAUuMZkdjjQSLcYnWgempyKqWymnyVwZga7H82WziovPr7jFz89vi6aarrM1bACu15o3z7oiTCs+Zb5ktmF3adXo2/aNkijNdRzIRr6KpEgMytmU5pfvVK4cc13SxxuAbSPA+kgy+AEcZ17l4+UhYHzjGh44U7PT0s9v++I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741963133; c=relaxed/simple; bh=omVwGwH+tvai1xWEI2/VPAx6grba7+WPfxfB6hPpCok=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gH3/pYe7k4hT9kdKrNm00vKKlyQaLT1lNAhwLoxCJh4ImCzORxiqTC8wZcyJCqKGVRg8eSWgg1W0pzFA9Xtm4HwTihjn2JFu3zYNvqM1TqLwzg3mrOUIs2jImoLEhpzFIajMImyUjrTBHfkaFMG1klcVX9/BrUHJA7zEKTHaBdw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ethancedwards.com; spf=pass smtp.mailfrom=ethancedwards.com; dkim=pass (2048-bit key) header.d=ethancedwards.com header.i=@ethancedwards.com header.b=kT3EnxgA; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ethancedwards.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ethancedwards.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ethancedwards.com header.i=@ethancedwards.com header.b="kT3EnxgA" Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4ZDn6n4VbXz9scL; Fri, 14 Mar 2025 15:38:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ethancedwards.com; s=MBO0001; t=1741963121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yl6oKjE2VPFEN1ImI40/0DFO/bK2RZZ4SFwIfhRzkX8=; b=kT3EnxgAy4hGUd0isbaVaSLESqzhlDddxebZVLD3LohYQFxAKISB9nG/6sAyN4zX6EQ9NZ tth7TJSjLyUifn1mXad59IzLDdcxonQue1b5TsMYqgU/nvX1p6yeitsd4KCazP1awugRPT i4ibzHgLO0hMl0LDKW5C6iM6x/SlzyRikqfL7xdVNiXG+2MPRrwQ1rd+ojUSB3Hf/FpL18 xjEqoMBe3yaEqCK3LwhlMKPbWGJCgKvETfJAVAImdAkMOxorDVbnrC84+xka5da/Gzs+Eg SHsxlfCq4KSTfAtyQabMwHC8u3OtCBUsE/qKDZz5lipULYRF9OwQHF7qJ9ADVQ== From: Ethan Carter Edwards Date: Fri, 14 Mar 2025 10:38:23 -0400 Subject: [PATCH 3/4] ASoC: Intel: max98373: move devm_kzalloc(..., size * n, ...) to devm_kcalloc Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250314-sound-avs-kcalloc-v1-3-985f2734c020@ethancedwards.com> References: <20250314-sound-avs-kcalloc-v1-0-985f2734c020@ethancedwards.com> In-Reply-To: <20250314-sound-avs-kcalloc-v1-0-985f2734c020@ethancedwards.com> To: Cezary Rojewski , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Pierre-Louis Bossart , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: gustavoars@kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Ethan Carter Edwards X-Developer-Signature: v=1; a=openpgp-sha256; l=1203; i=ethan@ethancedwards.com; h=from:subject:message-id; bh=omVwGwH+tvai1xWEI2/VPAx6grba7+WPfxfB6hPpCok=; b=LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgpvd0o0bkp2QXk4ekFKWGJEOXFoNThlVGp6e GhQcXlVeHBGK3hUNWpFWW1UMGlIMy8zQTl6ODhKQ1huS3pYK3QrCkh2cythZHVDd3duaXBlb3k2 MDA3U2xrWXhMZ1laTVVVV2Y3bktLYzkxSnloc1BPdlN4UE1IRllta0NFTVhKd0MKTUJFbFBvYi9 1ZXpwR3h5RmY4MjF0TnJ2M25yckd1TzlIZkUxU1o0MzVwYW1QZiswYkFhbkN5TkRqLzYyM0sxeQ p2N2I4eUZzUzdzelllWHhoZDR6djB0M1h1aVkzemRkN1VxUERBUURldDB4dgo9S2hCSwotLS0tL UVORCBQR1AgTUVTU0FHRS0tLS0tCg== X-Developer-Key: i=ethan@ethancedwards.com; a=openpgp; fpr=2E51F61839D1FA947A7300C234C04305D581DBFE Open coded arithmetic in allocator arguments is discouraged. Helper functions like kcalloc or, in this case, devm_kcalloc are preferred. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments Signed-off-by: Ethan Carter Edwards --- sound/soc/intel/avs/boards/max98373.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/avs/boards/max98373.c b/sound/soc/intel/avs/boards/max98373.c index 6f25e66344b7a4b46d6598619b6b1362cad8c39e..970f82bf4ce8920b1965a0b81e8623ab5bf91ef1 100644 --- a/sound/soc/intel/avs/boards/max98373.c +++ b/sound/soc/intel/avs/boards/max98373.c @@ -111,7 +111,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs) * 2, GFP_KERNEL); + dl->codecs = devm_kcalloc(dev, 2, sizeof(*dl->codecs), GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; From patchwork Fri Mar 14 14:38:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ethan Carter Edwards X-Patchwork-Id: 14016964 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9755420297B; Fri, 14 Mar 2025 14:38:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741963131; cv=none; b=VbTrPuMkdzVDfEsl5fDGUPVwnvdlABKDUANbpPUjnE4a1YnEdImYKHVKM/dNE0f+0kKdZuQFdo4thKga48GBlpT9UzhXs5qmtnHk4o9pfyQSPRJsEYlVnsi2I5znEmfIW4Gw2h8iUOUnJpKGg1k5/RnsWI0Icj9dzDMLgPtEo7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741963131; c=relaxed/simple; bh=hK5nAdOzOVBPKtAa3bvrdTBZMx8kFgBmbzpTeUx6xVs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ozKiRRqFx3obC0A2hNU6kzmk71/4pmXb1844w9iVPa7bMF4N2lZkyISvs5uZWit805AFXp5kAUem5rZfukabIw0J0qS84yMnMV/YtXrbjXjgwjb1pkn/srkl8OUw6AFbuKpgGu2AU7EE/kzzSvvubuXar86td2EroSxpT0iYnfk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ethancedwards.com; spf=pass smtp.mailfrom=ethancedwards.com; dkim=pass (2048-bit key) header.d=ethancedwards.com header.i=@ethancedwards.com header.b=LG1Q1cjw; arc=none smtp.client-ip=80.241.56.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ethancedwards.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ethancedwards.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ethancedwards.com header.i=@ethancedwards.com header.b="LG1Q1cjw" Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4ZDn6s4B9hz9smm; Fri, 14 Mar 2025 15:38:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ethancedwards.com; s=MBO0001; t=1741963125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zANwSsYgSk7QVAGua7pwVhPM3i4jh6ZRBE5JBsf5/m4=; b=LG1Q1cjw0b1pbIz0GnUxaRUq++5olw2by/tWrWcIqXrtb8RVrfEudBr/jcEITeBpPCwLX0 HM0kYBtz3Njfj+NEVChkx0do6l7uX+0rif1uWENV7vxU+31H5gURNACWH4j6nvp0hbv0kS ldFQjxQUbeEwr3tExfCCzM8Wg5Q6o/ruHQxK596EQc960nCEUIcnKLBChAERoTYMzEDLUi UjCgsj4cCcSUu24H3f1ixIyXP5UtR5TfufJi3t01qWsNmeWhnrh8yHDieHRXlXVyIO7wrc wwyplXubNO3PtZ8JtStnCtey5SNp1CDMbSdKv5ksC+VlNatuUaRb1QY788n3bw== From: Ethan Carter Edwards Date: Fri, 14 Mar 2025 10:38:24 -0400 Subject: [PATCH 4/4] ASoC: Intel: max98927: move devm_kzalloc(..., size * n, ...) to devm_kcalloc Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250314-sound-avs-kcalloc-v1-4-985f2734c020@ethancedwards.com> References: <20250314-sound-avs-kcalloc-v1-0-985f2734c020@ethancedwards.com> In-Reply-To: <20250314-sound-avs-kcalloc-v1-0-985f2734c020@ethancedwards.com> To: Cezary Rojewski , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Pierre-Louis Bossart , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: gustavoars@kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Ethan Carter Edwards X-Developer-Signature: v=1; a=openpgp-sha256; l=1203; i=ethan@ethancedwards.com; h=from:subject:message-id; bh=hK5nAdOzOVBPKtAa3bvrdTBZMx8kFgBmbzpTeUx6xVs=; b=LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgpvd0o0bkp2QXk4ekFKWGJEOXFoNThlVGp6e GhQcXlVeHBGK3hUM0RRZVhOcWhXNk9ndjc3dzllUDZmb3M1OW5lClBKZHZzc3ExTFczZlYyNlRm VzNVVWNyQ0lNYkZJQ3VteVBJL1J6bnRvZVlNaFoxL1hacGc1ckF5Z1F4aDRPSVUKZ0lsc0syVms yUCtkUDMxWDY0cmpIUFdWVzdaMHE5MHAyeDE1VHpXL01IajlrNVNYUEh0aTdqTDhNNjVMMnh6OQ pMYWZiK3huVDdRa0d3Y2ZYMzkvYmRzaG9qclNONSs1d3FlaFVaZ0QvMjA3WAo9WWpyZAotLS0tL UVORCBQR1AgTUVTU0FHRS0tLS0tCg== X-Developer-Key: i=ethan@ethancedwards.com; a=openpgp; fpr=2E51F61839D1FA947A7300C234C04305D581DBFE X-Rspamd-Queue-Id: 4ZDn6s4B9hz9smm Open coded arithmetic in allocator arguments is discouraged. Helper functions like kcalloc or, in this case, devm_kcalloc are preferred. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments Signed-off-by: Ethan Carter Edwards --- sound/soc/intel/avs/boards/max98927.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/avs/boards/max98927.c b/sound/soc/intel/avs/boards/max98927.c index e8e5d1c717cd398aeca506bf7d20b5819d8dd1a2..e4ce553bf1d6432b4c11ce44857d969ca6b54c83 100644 --- a/sound/soc/intel/avs/boards/max98927.c +++ b/sound/soc/intel/avs/boards/max98927.c @@ -108,7 +108,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs) * 2, GFP_KERNEL); + dl->codecs = devm_kcalloc(dev, 2, sizeof(*dl->codecs), GFP_KERNEL); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM;