Skip to contentSkip to conversation

thermal: intel: powerclamp: Return -ENOMEM on allocation failure

PATCH New Thorsten Blum 1 participant 1 message Nov 11 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: intel: powerclamp: Return -ENOMEM on allocation failure

cpumask_set() returns success (0) if alloc_cpumask_var() fails. Return -ENOMEM instead.

Fixes ebf519710218 ("thermal: intel: powerclamp: Add two module parameters")
---
 drivers/thermal/intel/intel_powerclamp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/thermal/intel/intel_powerclamp.c +3 -2
index 1ffcb0a699e5..df898fc3f3e6 100644
@@ -157,9 +157,10 @@ static int cpumask_set(const char *arg, const struct kernel_param *kp)
 		goto skip_cpumask_set;
 	}
 
-	ret = alloc_cpumask_var(&new_mask, GFP_KERNEL);
-	if (!ret)
+	if (!alloc_cpumask_var(&new_mask, GFP_KERNEL)) {
+		ret = -ENOMEM;
 		goto skip_cpumask_set;
+	}
 
 	ret = bitmap_parse(arg, strlen(arg), cpumask_bits(new_mask),
 			   nr_cpumask_bits);