Skip to contentSkip to conversation

cpufreq: sti-cpufreq: fix mem leak in sti_cpufreq_set_opp_info()

PATCH Applied Frank Lee 2 participants 2 messages Oct 12, 2020 – Oct 28, 2020

Subsystems (2)
lore
Share & tools
lore

Frank Lee

author
#0 lore raw

PATCH 1/1 cpufreq: sti-cpufreq: fix mem leak in sti_cpufreq_set_opp_info()

From: Yangtao Li <[email protected]>

Use dev_pm_opp_put_prop_name() to avoid mem leak, which free opp_table.

---
 drivers/cpufreq/sti-cpufreq.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/cpufreq/sti-cpufreq.c +6 -1
index a5ad96d29adc..9668a48dad33 100644
@@ -222,7 +222,8 @@ static int sti_cpufreq_set_opp_info(void)
 	opp_table = dev_pm_opp_set_supported_hw(dev, version, VERSION_ELEMENTS);
 	if (IS_ERR(opp_table)) {
 		dev_err(dev, "Failed to set supported hardware\n");
-		return PTR_ERR(opp_table);
+		ret = PTR_ERR(opp_table);
+		goto err_put_prop_name;
 	}
 
 	dev_dbg(dev, "pcode: %d major: %d minor: %d substrate: %d\n",
@@ -231,6 +232,10 @@ static int sti_cpufreq_set_opp_info(void)
 		version[0], version[1], version[2]);
 
 	return 0;
+
+err_put_prop_name:
+	dev_pm_opp_put_prop_name(opp_table);
+	return ret;
 }
 
 static int sti_cpufreq_fetch_syscon_registers(void)
Signature · 1 line
2.28.0
maintainer Applied
#1 lore raw
Quoted 25 lines · Frank Lee

From: Yangtao Li <[email protected]>

Use dev_pm_opp_put_prop_name() to avoid mem leak, which free opp_table.

---
 drivers/cpufreq/sti-cpufreq.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/cpufreq/sti-cpufreq.c +2 -1
index a5ad96d29adc..9668a48dad33 100644
@@ -222,7 +222,8 @@ static int sti_cpufreq_set_opp_info(void)
 	opp_table = dev_pm_opp_set_supported_hw(dev, version, VERSION_ELEMENTS);
 	if (IS_ERR(opp_table)) {
 		dev_err(dev, "Failed to set supported hardware\n");
-		return PTR_ERR(opp_table);
+		ret = PTR_ERR(opp_table);
+		goto err_put_prop_name;
 	}
 
 	dev_dbg(dev, "pcode: %d major: %d minor: %d substrate: %d\n",

drivers/cpufreq/sti-cpufreq.c static int sti_cpufreq_set_opp_info(void) · line 241

Quoted 10 lines
drivers/cpufreq/sti-cpufreq.c +4 -0
@@ -231,6 +232,10 @@ static int sti_cpufreq_set_opp_info(void)
 		version[0], version[1], version[2]);
 
 	return 0;
+
+err_put_prop_name:
+	dev_pm_opp_put_prop_name(opp_table);
+	return ret;
 }
 
 static int sti_cpufreq_fetch_syscon_registers(void)

Applied. Thanks.

Signature · 6 lines
viresh

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel