Skip to contentSkip to conversation

clk: sprd: add missing kfree

PATCH Applied Chunyan Zhang 2 participants 3 messages Sep 5, 2019 – Sep 18, 2019

Subsystems (2)
lore
Share & tools
lore

Chunyan Zhang

author reviewer
#0 lore raw

PATCH 1/1 clk: sprd: add missing kfree

From: Chunyan Zhang <[email protected]>

The number of config registers for different pll clocks probably are not same, so we have to use malloc, and should free the memory before return.

Fixes 3e37b005580b ("clk: sprd: add adjustable pll support")
---
 drivers/clk/sprd/pll.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/sprd/pll.c +2 -0
index 36b4402bf09e..640270f51aa5 100644
@@ -136,6 +136,7 @@ static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll,
 					 k2 + refin * nint * CLK_PLL_1M;
 	}
 
+	kfree(cfg);
 	return rate;
 }
 
@@ -222,6 +223,7 @@ static int _sprd_pll_set_rate(const struct sprd_pll *pll,
 	if (!ret)
 		udelay(pll->udelay);
 
+	kfree(cfg);
 	return ret;
 }
 
Signature · 1 line
2.20.1
author reviewer
#1 lore raw

gentle ping

Quoted 36 lines · Chunyan Zhang

From: Chunyan Zhang <[email protected]>

The number of config registers for different pll clocks probably are not same, so we have to use malloc, and should free the memory before return.

Fixes 3e37b005580b ("clk: sprd: add adjustable pll support")
---
 drivers/clk/sprd/pll.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/sprd/pll.c +2 -1
index 36b4402bf09e..640270f51aa5 100644
@@ -136,6 +136,7 @@ static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll,
                                         k2 + refin * nint * CLK_PLL_1M;
        }
 
+       kfree(cfg);
        return rate;
 }
 
@@ -222,6 +223,7 @@ static int _sprd_pll_set_rate(const struct sprd_pll *pll,
        if (!ret)
                udelay(pll->udelay);
 
+       kfree(cfg);
        return ret;
 }
 
--

2.20.1

maintainer Applied
#2 lore raw
In reply to Chunyan Zhang

Quoting Chunyan Zhang (2019-09-05 03:30:09)

Quoted 9 lines

From: Chunyan Zhang <[email protected]>

The number of config registers for different pll clocks probably are not same, so we have to use malloc, and should free the memory before return.

Fixes 3e37b005580b ("clk: sprd: add adjustable pll support")

---

Applied to clk-next