Skip to contentSkip to conversation

clk: scmi: Free scmi_clk allocated when the clocks with invalid info are skipped

PATCH Applied Sudeep Holla 3 participants 4 messages Oct 4, 2023 – Oct 19, 2023

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

PATCH 1/1 clk: scmi: Free scmi_clk allocated when the clocks with invalid info are skipped

Add the missing devm_kfree() when we skip the clocks with invalid or missing information from the firmware.

Cc Cristian Marussi <[email protected]>
Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Fixes 6d6a1d82eaef ("clk: add support for clocks provided by SCMI")
---
 drivers/clk/clk-scmi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/clk-scmi.c +1 -0
index 2e1337b511eb..3f525bed9794 100644
@@ -232,6 +232,7 @@ static int scmi_clocks_probe(struct scmi_device *sdev)
 		sclk->info = scmi_proto_clk_ops->info_get(ph, idx);
 		if (!sclk->info) {
 			dev_dbg(dev, "invalid clock info for idx %d\n", idx);
+			devm_kfree(dev, sclk);
 			continue;
 		}
 
Signature · 1 line
2.42.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Sudeep Holla

Add the missing devm_kfree() when we skip the clocks with invalid or missing information from the firmware.

Hi,

LGTM.

Thanks,
Cristian

Quoted 25 lines
Cc Cristian Marussi <[email protected]>
Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Fixes 6d6a1d82eaef ("clk: add support for clocks provided by SCMI")
---
 drivers/clk/clk-scmi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/clk-scmi.c +1 -0
index 2e1337b511eb..3f525bed9794 100644
@@ -232,6 +232,7 @@ static int scmi_clocks_probe(struct scmi_device *sdev)
 		sclk->info = scmi_proto_clk_ops->info_get(ph, idx);
 		if (!sclk->info) {
 			dev_dbg(dev, "invalid clock info for idx %d\n", idx);
+			devm_kfree(dev, sclk);
 			continue;
 		}
 
Signature · 1 line
2.42.0

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

author Applied
#2 lore raw
In reply to Sudeep Holla
Quoted 3 lines · Sudeep Holla

Add the missing devm_kfree() when we skip the clocks with invalid or missing information from the firmware.

Hi Stephen,

Since you have acked other changes in the same driver and agreed to take it via SoC tree, I have applied this simple fix.

Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!

[1/1] clk: scmi: Free scmi_clk allocated when the clocks with invalid info are skipped

      https://git.kernel.org/sudeep.holla/c/3537a75e73f3

--
Regards,
Sudeep

maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Sudeep Holla

Quoting Sudeep Holla (2023-10-04 12:36:00)

Quoted 10 lines

Add the missing devm_kfree() when we skip the clocks with invalid or missing information from the firmware.

Cc Cristian Marussi <[email protected]>
Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Fixes 6d6a1d82eaef ("clk: add support for clocks provided by SCMI")

---