public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] clk: keystone: sci-clk: use devm_kmemdup_array()
@ 2025-09-16 12:45 Raag Jadav
  2025-09-16 12:52 ` Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Raag Jadav @ 2025-09-16 12:45 UTC (permalink / raw)
  To: nm, kristo, ssantosh, mturquette, sboyd
  Cc: linux-kernel, linux-clk, andriy.shevchenko, Raag Jadav

Convert to use devm_kmemdup_array() which is more robust.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
 drivers/clk/keystone/sci-clk.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
index c5894fc9395e..a4b42811de55 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -480,13 +480,10 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider)
 		num_clks++;
 	}
 
-	provider->clocks = devm_kmalloc_array(dev, num_clks, sizeof(sci_clk),
-					      GFP_KERNEL);
+	provider->clocks = devm_kmemdup_array(dev, clks, num_clks, sizeof(sci_clk), GFP_KERNEL);
 	if (!provider->clocks)
 		return -ENOMEM;
 
-	memcpy(provider->clocks, clks, num_clks * sizeof(sci_clk));
-
 	provider->num_clocks = num_clks;
 
 	devm_kfree(dev, clks);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-09-20  5:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-16 12:45 [PATCH v1] clk: keystone: sci-clk: use devm_kmemdup_array() Raag Jadav
2025-09-16 12:52 ` Andy Shevchenko
2025-09-16 12:53   ` Andy Shevchenko
2025-09-16 13:18     ` Raag Jadav
2025-09-16 13:21       ` Andy Shevchenko
2025-09-17 14:30 ` Nishanth Menon
2025-09-20  5:30 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox