Skip to contentSkip to conversation

PM / QOS: Use kcalloc() instead of kzalloc()

PATCH Applied Erick Archer 3 participants 3 messages Jan 5, 2024 – Jan 9, 2024

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

PATCH 1/1 PM / QOS: Use kcalloc() instead of kzalloc()

Use 2-factor multiplication argument form kcalloc() instead of kzalloc().

---
 drivers/base/power/qos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/qos.c +1 -1
index 8e93167f1783..bd77f6734f14 100644
@@ -201,7 +201,7 @@ static int dev_pm_qos_constraints_allocate(struct device *dev)
 	if (!qos)
 		return -ENOMEM;
 
-	n = kzalloc(3 * sizeof(*n), GFP_KERNEL);
+	n = kcalloc(3, sizeof(*n), GFP_KERNEL);
 	if (!n) {
 		kfree(qos);
 		return -ENOMEM;

--
2.42.0

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

Use 2-factor multiplication argument form kcalloc() instead of kzalloc().

Thanks!

Signature · 1 line
Gustavo
Quoted 21 lines
---
  drivers/base/power/qos.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/qos.c +1 -2
index 8e93167f1783..bd77f6734f14 100644
@@ -201,7 +201,7 @@ static int dev_pm_qos_constraints_allocate(struct device *dev)
  	if (!qos)
  		return -ENOMEM;
 
-	n = kzalloc(3 * sizeof(*n), GFP_KERNEL);
+	n = kcalloc(3, sizeof(*n), GFP_KERNEL);
  	if (!n) {
  		kfree(qos);
  		return -ENOMEM;
--

2.42.0

maintainer Applied
#2 lore raw
Quoted 11 lines · Gustavo A. R. Silva
Quoted 5 lines · Erick Archer

Use 2-factor multiplication argument form kcalloc() instead of kzalloc().

Applied as 6.8-rc1 material, thanks!

Quoted 21 lines
Quoted 21 lines
---
  drivers/base/power/qos.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/qos.c +1 -2
index 8e93167f1783..bd77f6734f14 100644
@@ -201,7 +201,7 @@ static int dev_pm_qos_constraints_allocate(struct device *dev)
      if (!qos)
              return -ENOMEM;
 
-     n = kzalloc(3 * sizeof(*n), GFP_KERNEL);
+     n = kcalloc(3, sizeof(*n), GFP_KERNEL);
      if (!n) {
              kfree(qos);
              return -ENOMEM;
--

2.42.0