Skip to contentSkip to conversation

drivers: clk: altera: arria10: Fix wrong API used for memory free

PATCH Superseded [email protected] 2 participants 3 messages Feb 25 – Apr 15 Common clk

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: clk: altera: arria10: Fix wrong API used for memory free

From: Dinesh Maniyam <[email protected]>

Fix the wrong API used for memory free.

---
 drivers/clk/altera/clk-arria10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/altera/clk-arria10.c +1 -1
index 1840f73beee..e56e94adae0 100644
@@ -223,7 +223,7 @@ static void socfpga_a10_handoff_workaround(struct udevice *dev)
 
 	ret = clk_request(dev, &bulk->clks[0]);
 	if (ret)
-		free(bulk->clks);
+		devm_kfree(dev, bulk->clks);
 }
 
 static int socfpga_a10_clk_bind(struct udevice *dev)
Signature · 1 line
2.43.7
#1 lore raw

Hi Dinesh,

Quoted 23 lines

From: Maniyam, Dinesh <[email protected]>
Sent: Wednesday, February 25, 2026 1:01 PM
To: [email protected] <[email protected]>
Cc: Marek Vasut <[email protected]>; Simon Goldschmidt <[email protected]>; Tom Rini <[email protected]>; Lukasz Majewski <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>
Subject: [PATCH] drivers: clk: altera: arria10: Fix wrong API used for memory free
From: Dinesh Maniyam <[email protected]>
Fix the wrong API used for memory free.

---
 drivers/clk/altera/clk-arria10.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/altera/clk-arria10.c +0 -0
index 1840f73beee..e56e94adae0 100644

drivers/clk/altera/clk-arria10.c static void socfpga_a10_handoff_workaround(struct udevice · line 226

Quoted 5 lines
drivers/clk/altera/clk-arria10.c +1 -1
@@ -223,7 +223,7 @@ static void socfpga_a10_handoff_workaround(struct udevice
 *dev)
          ret = clk_request(dev, &bulk->clks[0]);
          if (ret)
-               free(bulk->clks);
+               devm_kfree(dev, bulk->clks);

you must still reset bulk->clks = NULL and bulk->count = 0 so nothing reads the old shape, treating pointer/count reset as part of “secure cleanup”

    bulk->clks = NULL;
    bulk->count = 0;
Quoted 4 lines
drivers/clk/altera/clk-arria10.c +0 -1
  }
  static int socfpga_a10_clk_bind(struct udevice *dev)
--

2.43.7

Best regards,
Tien Fong

#2 lore raw

Hi TF,

Quoted 45 lines · Tien Fong

Hi Dinesh,

Quoted 23 lines

From: Maniyam, Dinesh <[email protected]>
Sent: Wednesday, February 25, 2026 1:01 PM
To: [email protected] <[email protected]>
Cc: Marek Vasut <[email protected]>; Simon Goldschmidt <[email protected]>; Tom Rini <[email protected]>; Lukasz Majewski <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>
Subject: [PATCH] drivers: clk: altera: arria10: Fix wrong API used for memory free
From: Dinesh Maniyam <[email protected]>
Fix the wrong API used for memory free.

---
  drivers/clk/altera/clk-arria10.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/altera/clk-arria10.c +0 -0
index 1840f73beee..e56e94adae0 100644

drivers/clk/altera/clk-arria10.c static void socfpga_a10_handoff_workaround(struct udevice · line 226

Quoted 5 lines
drivers/clk/altera/clk-arria10.c +1 -1
@@ -223,7 +223,7 @@ static void socfpga_a10_handoff_workaround(struct udevice
 *dev)
          ret = clk_request(dev, &bulk->clks[0]);
          if (ret)
-               free(bulk->clks);
+               devm_kfree(dev, bulk->clks);

you must still reset bulk->clks = NULL and bulk->count = 0 so nothing reads the old shape, treating pointer/count reset as part of “secure cleanup”

     bulk->clks = NULL;
     bulk->count = 0;
Quoted 4 lines
drivers/clk/altera/clk-arria10.c +0 -1
  }
  static int socfpga_a10_clk_bind(struct udevice *dev)
--

2.43.7

Best regards,
Tien Fong

Agreed. Changes will be done on v2.

Dinesh