Skip to contentSkip to conversation

ASoC: ti: Use devm_kcalloc() instead of devm_kzalloc()

PATCH In review Erick Archer 3 participants 3 messages Jan 6, 2024 – Jan 8, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: ti: Use devm_kcalloc() instead of devm_kzalloc()

Use 2-factor multiplication argument form devm_kcalloc() instead of devm_kzalloc().

---
 sound/soc/ti/j721e-evm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/ti/j721e-evm.c +2 -2
index b4b158dc736e..d9d1e021f5b2 100644
@@ -649,7 +649,7 @@ static int j721e_soc_probe_cpb(struct j721e_priv *priv, int *link_idx,
 	 * Link 2: McASP10 <- pcm3168a_1 ADC
 	 */
 	comp_count = 6;
-	compnent = devm_kzalloc(priv->dev, comp_count * sizeof(*compnent),
+	compnent = devm_kcalloc(priv->dev, comp_count, sizeof(*compnent),
 				GFP_KERNEL);
 	if (!compnent) {
 		ret = -ENOMEM;
@@ -763,7 +763,7 @@ static int j721e_soc_probe_ivi(struct j721e_priv *priv, int *link_idx,
 	 *		   \ pcm3168a_b ADC
 	 */
 	comp_count = 8;
-	compnent = devm_kzalloc(priv->dev, comp_count * sizeof(*compnent),
+	compnent = devm_kcalloc(priv->dev, comp_count, sizeof(*compnent),
 				GFP_KERNEL);
 	if (!compnent) {
 		ret = -ENOMEM;

--
2.25.1

Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Erick Archer

Use 2-factor multiplication argument form devm_kcalloc() instead of devm_kzalloc().

Thanks!

Signature · 1 line
Gustavo
Quoted 30 lines
---
  sound/soc/ti/j721e-evm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/ti/j721e-evm.c +2 -3
index b4b158dc736e..d9d1e021f5b2 100644
@@ -649,7 +649,7 @@ static int j721e_soc_probe_cpb(struct j721e_priv *priv, int *link_idx,
  	 * Link 2: McASP10 <- pcm3168a_1 ADC
  	 */
  	comp_count = 6;
-	compnent = devm_kzalloc(priv->dev, comp_count * sizeof(*compnent),
+	compnent = devm_kcalloc(priv->dev, comp_count, sizeof(*compnent),
  				GFP_KERNEL);
  	if (!compnent) {
  		ret = -ENOMEM;
@@ -763,7 +763,7 @@ static int j721e_soc_probe_ivi(struct j721e_priv *priv, int *link_idx,
  	 *		   \ pcm3168a_b ADC
  	 */
  	comp_count = 8;
-	compnent = devm_kzalloc(priv->dev, comp_count * sizeof(*compnent),
+	compnent = devm_kcalloc(priv->dev, comp_count, sizeof(*compnent),
  				GFP_KERNEL);
  	if (!compnent) {
  		ret = -ENOMEM;
--

2.25.1

Acked-by on v1 1/1
#2 lore raw
In reply to Erick Archer
Quoted 5 lines · Erick Archer

Use 2-factor multiplication argument form devm_kcalloc() instead of devm_kzalloc().

Can you fix the commit title to:
ASoC: ti: j721e-evm.: Use devm_kcalloc() instead of devm_kzalloc()

and send v2 with my:

Quoted 29 lines
---
 sound/soc/ti/j721e-evm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/ti/j721e-evm.c +2 -3
index b4b158dc736e..d9d1e021f5b2 100644
@@ -649,7 +649,7 @@ static int j721e_soc_probe_cpb(struct j721e_priv *priv, int *link_idx,
 	 * Link 2: McASP10 <- pcm3168a_1 ADC
 	 */
 	comp_count = 6;
-	compnent = devm_kzalloc(priv->dev, comp_count * sizeof(*compnent),
+	compnent = devm_kcalloc(priv->dev, comp_count, sizeof(*compnent),
 				GFP_KERNEL);
 	if (!compnent) {
 		ret = -ENOMEM;
@@ -763,7 +763,7 @@ static int j721e_soc_probe_ivi(struct j721e_priv *priv, int *link_idx,
 	 *		   \ pcm3168a_b ADC
 	 */
 	comp_count = 8;
-	compnent = devm_kzalloc(priv->dev, comp_count * sizeof(*compnent),
+	compnent = devm_kcalloc(priv->dev, comp_count, sizeof(*compnent),
 				GFP_KERNEL);
 	if (!compnent) {
 		ret = -ENOMEM;
--

2.25.1

Signature · 1 line
Péter