summaryrefslogtreecommitdiff
path: root/drivers/clk/imx
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2026-02-20 23:49:23 -0800
committerKees Cook <kees@kernel.org>2026-02-21 01:02:28 -0800
commit69050f8d6d075dc01af7a5f2f550a8067510366f (patch)
treebb265f94d9dfa7876c06a5d9f88673d496a15341 /drivers/clk/imx
parentd39a1d7486d98668dd34aaa6732aad7977c45f5a (diff)
downloadlwn-69050f8d6d075dc01af7a5f2f550a8067510366f.tar.gz
lwn-69050f8d6d075dc01af7a5f2f550a8067510366f.zip
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Coccinelle script from scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to avoid scalar types (which need careful case-by-case checking), and instead replace kmalloc-family calls that allocate struct or union object instances: Single allocations: kmalloc(sizeof(TYPE), ...) are replaced with: kmalloc_obj(TYPE, ...) Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...) are replaced with: kmalloc_objs(TYPE, COUNT, ...) Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...) are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...) (where TYPE may also be *VAR) The resulting allocations no longer return "void *", instead returning "TYPE *". Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'drivers/clk/imx')
-rw-r--r--drivers/clk/imx/clk-busy.c4
-rw-r--r--drivers/clk/imx/clk-composite-7ulp.c6
-rw-r--r--drivers/clk/imx/clk-composite-8m.c6
-rw-r--r--drivers/clk/imx/clk-composite-93.c6
-rw-r--r--drivers/clk/imx/clk-cpu.c2
-rw-r--r--drivers/clk/imx/clk-divider-gate.c2
-rw-r--r--drivers/clk/imx/clk-fixup-div.c2
-rw-r--r--drivers/clk/imx/clk-fixup-mux.c2
-rw-r--r--drivers/clk/imx/clk-frac-pll.c2
-rw-r--r--drivers/clk/imx/clk-fracn-gppll.c2
-rw-r--r--drivers/clk/imx/clk-gate-93.c2
-rw-r--r--drivers/clk/imx/clk-gate-exclusive.c2
-rw-r--r--drivers/clk/imx/clk-gate2.c2
-rw-r--r--drivers/clk/imx/clk-gpr-mux.c2
-rw-r--r--drivers/clk/imx/clk-imx6q.c4
-rw-r--r--drivers/clk/imx/clk-imx6sl.c4
-rw-r--r--drivers/clk/imx/clk-imx6sll.c4
-rw-r--r--drivers/clk/imx/clk-imx6sx.c4
-rw-r--r--drivers/clk/imx/clk-imx6ul.c4
-rw-r--r--drivers/clk/imx/clk-imx7d.c3
-rw-r--r--drivers/clk/imx/clk-imx7ulp.c16
-rw-r--r--drivers/clk/imx/clk-imx8mm.c4
-rw-r--r--drivers/clk/imx/clk-lpcg-scu.c2
-rw-r--r--drivers/clk/imx/clk-pfd.c2
-rw-r--r--drivers/clk/imx/clk-pfdv2.c2
-rw-r--r--drivers/clk/imx/clk-pll14xx.c2
-rw-r--r--drivers/clk/imx/clk-pllv1.c2
-rw-r--r--drivers/clk/imx/clk-pllv2.c2
-rw-r--r--drivers/clk/imx/clk-pllv3.c2
-rw-r--r--drivers/clk/imx/clk-pllv4.c2
-rw-r--r--drivers/clk/imx/clk-scu.c6
-rw-r--r--drivers/clk/imx/clk-sscg-pll.c2
-rw-r--r--drivers/clk/imx/clk.c2
33 files changed, 55 insertions, 56 deletions
diff --git a/drivers/clk/imx/clk-busy.c b/drivers/clk/imx/clk-busy.c
index eb27c6fee359..a6886a73aa24 100644
--- a/drivers/clk/imx/clk-busy.c
+++ b/drivers/clk/imx/clk-busy.c
@@ -82,7 +82,7 @@ struct clk_hw *imx_clk_hw_busy_divider(const char *name, const char *parent_name
struct clk_init_data init;
int ret;
- busy = kzalloc(sizeof(*busy), GFP_KERNEL);
+ busy = kzalloc_obj(*busy, GFP_KERNEL);
if (!busy)
return ERR_PTR(-ENOMEM);
@@ -162,7 +162,7 @@ struct clk_hw *imx_clk_hw_busy_mux(const char *name, void __iomem *reg, u8 shift
struct clk_init_data init;
int ret;
- busy = kzalloc(sizeof(*busy), GFP_KERNEL);
+ busy = kzalloc_obj(*busy, GFP_KERNEL);
if (!busy)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-composite-7ulp.c b/drivers/clk/imx/clk-composite-7ulp.c
index 37d2fc197be6..59c2b392db44 100644
--- a/drivers/clk/imx/clk-composite-7ulp.c
+++ b/drivers/clk/imx/clk-composite-7ulp.c
@@ -99,7 +99,7 @@ static struct clk_hw *imx_ulp_clk_hw_composite(const char *name,
}
if (mux_present) {
- mux = kzalloc(sizeof(*mux), GFP_KERNEL);
+ mux = kzalloc_obj(*mux, GFP_KERNEL);
if (!mux)
return ERR_PTR(-ENOMEM);
mux_hw = &mux->hw;
@@ -111,7 +111,7 @@ static struct clk_hw *imx_ulp_clk_hw_composite(const char *name,
}
if (rate_present) {
- fd = kzalloc(sizeof(*fd), GFP_KERNEL);
+ fd = kzalloc_obj(*fd, GFP_KERNEL);
if (!fd) {
kfree(mux);
return ERR_PTR(-ENOMEM);
@@ -128,7 +128,7 @@ static struct clk_hw *imx_ulp_clk_hw_composite(const char *name,
}
if (gate_present) {
- gate = kzalloc(sizeof(*gate), GFP_KERNEL);
+ gate = kzalloc_obj(*gate, GFP_KERNEL);
if (!gate) {
kfree(mux);
kfree(fd);
diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c
index 1467d0a1b934..e5ccb6810822 100644
--- a/drivers/clk/imx/clk-composite-8m.c
+++ b/drivers/clk/imx/clk-composite-8m.c
@@ -231,7 +231,7 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
const struct clk_ops *mux_ops;
const struct clk_ops *gate_ops;
- mux = kzalloc(sizeof(*mux), GFP_KERNEL);
+ mux = kzalloc_obj(*mux, GFP_KERNEL);
if (!mux)
return ERR_CAST(hw);
@@ -241,7 +241,7 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
mux->mask = PCG_PCS_MASK;
mux->lock = &imx_ccm_lock;
- div = kzalloc(sizeof(*div), GFP_KERNEL);
+ div = kzalloc_obj(*div, GFP_KERNEL);
if (!div)
goto free_mux;
@@ -270,7 +270,7 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
div->flags = CLK_DIVIDER_ROUND_CLOSEST;
/* skip registering the gate ops if M4 is enabled */
- gate = kzalloc(sizeof(*gate), GFP_KERNEL);
+ gate = kzalloc_obj(*gate, GFP_KERNEL);
if (!gate)
goto free_div;
diff --git a/drivers/clk/imx/clk-composite-93.c b/drivers/clk/imx/clk-composite-93.c
index 513d74a39d3b..db006eba18f8 100644
--- a/drivers/clk/imx/clk-composite-93.c
+++ b/drivers/clk/imx/clk-composite-93.c
@@ -193,7 +193,7 @@ struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *p
bool clk_ro = false;
u32 authen;
- mux = kzalloc(sizeof(*mux), GFP_KERNEL);
+ mux = kzalloc_obj(*mux, GFP_KERNEL);
if (!mux)
goto fail;
@@ -203,7 +203,7 @@ struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *p
mux->mask = CCM_MUX_MASK;
mux->lock = &imx_ccm_lock;
- div = kzalloc(sizeof(*div), GFP_KERNEL);
+ div = kzalloc_obj(*div, GFP_KERNEL);
if (!div)
goto fail;
@@ -223,7 +223,7 @@ struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *p
mux_hw, &clk_mux_ro_ops, div_hw,
&clk_divider_ro_ops, NULL, NULL, flags);
} else {
- gate = kzalloc(sizeof(*gate), GFP_KERNEL);
+ gate = kzalloc_obj(*gate, GFP_KERNEL);
if (!gate)
goto fail;
diff --git a/drivers/clk/imx/clk-cpu.c b/drivers/clk/imx/clk-cpu.c
index 43637cb61693..e63296483504 100644
--- a/drivers/clk/imx/clk-cpu.c
+++ b/drivers/clk/imx/clk-cpu.c
@@ -81,7 +81,7 @@ struct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name,
struct clk_init_data init;
int ret;
- cpu = kzalloc(sizeof(*cpu), GFP_KERNEL);
+ cpu = kzalloc_obj(*cpu, GFP_KERNEL);
if (!cpu)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-divider-gate.c b/drivers/clk/imx/clk-divider-gate.c
index 26b210cba9be..51042ba556d0 100644
--- a/drivers/clk/imx/clk-divider-gate.c
+++ b/drivers/clk/imx/clk-divider-gate.c
@@ -185,7 +185,7 @@ struct clk_hw *imx_clk_hw_divider_gate(const char *name, const char *parent_name
u32 val;
int ret;
- div_gate = kzalloc(sizeof(*div_gate), GFP_KERNEL);
+ div_gate = kzalloc_obj(*div_gate, GFP_KERNEL);
if (!div_gate)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-fixup-div.c b/drivers/clk/imx/clk-fixup-div.c
index aa6addbeb5a8..a90609aec218 100644
--- a/drivers/clk/imx/clk-fixup-div.c
+++ b/drivers/clk/imx/clk-fixup-div.c
@@ -97,7 +97,7 @@ struct clk_hw *imx_clk_hw_fixup_divider(const char *name, const char *parent,
if (!fixup)
return ERR_PTR(-EINVAL);
- fixup_div = kzalloc(sizeof(*fixup_div), GFP_KERNEL);
+ fixup_div = kzalloc_obj(*fixup_div, GFP_KERNEL);
if (!fixup_div)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-fixup-mux.c b/drivers/clk/imx/clk-fixup-mux.c
index 418ac9fe2c26..b1c887fc99c4 100644
--- a/drivers/clk/imx/clk-fixup-mux.c
+++ b/drivers/clk/imx/clk-fixup-mux.c
@@ -77,7 +77,7 @@ struct clk_hw *imx_clk_hw_fixup_mux(const char *name, void __iomem *reg,
if (!fixup)
return ERR_PTR(-EINVAL);
- fixup_mux = kzalloc(sizeof(*fixup_mux), GFP_KERNEL);
+ fixup_mux = kzalloc_obj(*fixup_mux, GFP_KERNEL);
if (!fixup_mux)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-frac-pll.c b/drivers/clk/imx/clk-frac-pll.c
index eb668faaa38f..fba0c0f449df 100644
--- a/drivers/clk/imx/clk-frac-pll.c
+++ b/drivers/clk/imx/clk-frac-pll.c
@@ -213,7 +213,7 @@ struct clk_hw *imx_clk_hw_frac_pll(const char *name,
struct clk_hw *hw;
int ret;
- pll = kzalloc(sizeof(*pll), GFP_KERNEL);
+ pll = kzalloc_obj(*pll, GFP_KERNEL);
if (!pll)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-fracn-gppll.c b/drivers/clk/imx/clk-fracn-gppll.c
index 6de5349adf70..3cd1fd106aac 100644
--- a/drivers/clk/imx/clk-fracn-gppll.c
+++ b/drivers/clk/imx/clk-fracn-gppll.c
@@ -366,7 +366,7 @@ static struct clk_hw *_imx_clk_fracn_gppll(const char *name, const char *parent_
struct clk_init_data init;
int ret;
- pll = kzalloc(sizeof(*pll), GFP_KERNEL);
+ pll = kzalloc_obj(*pll, GFP_KERNEL);
if (!pll)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-gate-93.c b/drivers/clk/imx/clk-gate-93.c
index ceb56b290394..0422e17a8233 100644
--- a/drivers/clk/imx/clk-gate-93.c
+++ b/drivers/clk/imx/clk-gate-93.c
@@ -164,7 +164,7 @@ struct clk_hw *imx93_clk_gate(struct device *dev, const char *name, const char *
int ret;
u32 authen;
- gate = kzalloc(sizeof(struct imx93_clk_gate), GFP_KERNEL);
+ gate = kzalloc_obj(struct imx93_clk_gate, GFP_KERNEL);
if (!gate)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-gate-exclusive.c b/drivers/clk/imx/clk-gate-exclusive.c
index 7017e9d4e188..2f0db88cbbcf 100644
--- a/drivers/clk/imx/clk-gate-exclusive.c
+++ b/drivers/clk/imx/clk-gate-exclusive.c
@@ -67,7 +67,7 @@ struct clk_hw *imx_clk_hw_gate_exclusive(const char *name, const char *parent,
if (exclusive_mask == 0)
return ERR_PTR(-EINVAL);
- exgate = kzalloc(sizeof(*exgate), GFP_KERNEL);
+ exgate = kzalloc_obj(*exgate, GFP_KERNEL);
if (!exgate)
return ERR_PTR(-ENOMEM);
gate = &exgate->gate;
diff --git a/drivers/clk/imx/clk-gate2.c b/drivers/clk/imx/clk-gate2.c
index f16c4019f402..d57c146a66cf 100644
--- a/drivers/clk/imx/clk-gate2.c
+++ b/drivers/clk/imx/clk-gate2.c
@@ -144,7 +144,7 @@ struct clk_hw *clk_hw_register_gate2(struct device *dev, const char *name,
struct clk_init_data init;
int ret;
- gate = kzalloc(sizeof(struct clk_gate2), GFP_KERNEL);
+ gate = kzalloc_obj(struct clk_gate2, GFP_KERNEL);
if (!gate)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-gpr-mux.c b/drivers/clk/imx/clk-gpr-mux.c
index 0e14b61cba84..01f7142e7a98 100644
--- a/drivers/clk/imx/clk-gpr-mux.c
+++ b/drivers/clk/imx/clk-gpr-mux.c
@@ -87,7 +87,7 @@ struct clk_hw *imx_clk_gpr_mux(const char *name, const char *compatible,
return ERR_CAST(regmap);
}
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c
index bf4c1d9c9928..7d8a811e5de4 100644
--- a/drivers/clk/imx/clk-imx6q.c
+++ b/drivers/clk/imx/clk-imx6q.c
@@ -439,8 +439,8 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
void __iomem *anatop_base, *base;
int ret;
- clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
- IMX6QDL_CLK_END), GFP_KERNEL);
+ clk_hw_data = kzalloc_flex(*clk_hw_data, hws, IMX6QDL_CLK_END,
+ GFP_KERNEL);
if (WARN_ON(!clk_hw_data))
return;
diff --git a/drivers/clk/imx/clk-imx6sl.c b/drivers/clk/imx/clk-imx6sl.c
index 47b8667cfa3f..de7392fb59a4 100644
--- a/drivers/clk/imx/clk-imx6sl.c
+++ b/drivers/clk/imx/clk-imx6sl.c
@@ -185,8 +185,8 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
void __iomem *base;
int ret;
- clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
- IMX6SL_CLK_END), GFP_KERNEL);
+ clk_hw_data = kzalloc_flex(*clk_hw_data, hws, IMX6SL_CLK_END,
+ GFP_KERNEL);
if (WARN_ON(!clk_hw_data))
return;
diff --git a/drivers/clk/imx/clk-imx6sll.c b/drivers/clk/imx/clk-imx6sll.c
index 2fa70bf35e45..96c1fbb74d82 100644
--- a/drivers/clk/imx/clk-imx6sll.c
+++ b/drivers/clk/imx/clk-imx6sll.c
@@ -81,8 +81,8 @@ static void __init imx6sll_clocks_init(struct device_node *ccm_node)
struct device_node *np;
void __iomem *base;
- clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
- IMX6SLL_CLK_END), GFP_KERNEL);
+ clk_hw_data = kzalloc_flex(*clk_hw_data, hws, IMX6SLL_CLK_END,
+ GFP_KERNEL);
if (WARN_ON(!clk_hw_data))
return;
diff --git a/drivers/clk/imx/clk-imx6sx.c b/drivers/clk/imx/clk-imx6sx.c
index 69f8f6f9ca49..c96606f76947 100644
--- a/drivers/clk/imx/clk-imx6sx.c
+++ b/drivers/clk/imx/clk-imx6sx.c
@@ -123,8 +123,8 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
void __iomem *base;
bool lcdif1_assigned_clk;
- clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
- IMX6SX_CLK_CLK_END), GFP_KERNEL);
+ clk_hw_data = kzalloc_flex(*clk_hw_data, hws, IMX6SX_CLK_CLK_END,
+ GFP_KERNEL);
if (WARN_ON(!clk_hw_data))
return;
diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index 05c7a82b751f..4ccc272b3c4f 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -130,8 +130,8 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node)
struct device_node *np;
void __iomem *base;
- clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
- IMX6UL_CLK_END), GFP_KERNEL);
+ clk_hw_data = kzalloc_flex(*clk_hw_data, hws, IMX6UL_CLK_END,
+ GFP_KERNEL);
if (WARN_ON(!clk_hw_data))
return;
diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c
index 99adc55e3f5d..21c6daa221cc 100644
--- a/drivers/clk/imx/clk-imx7d.c
+++ b/drivers/clk/imx/clk-imx7d.c
@@ -382,8 +382,7 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node)
struct device_node *np;
void __iomem *base;
- clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
- IMX7D_CLK_END), GFP_KERNEL);
+ clk_hw_data = kzalloc_flex(*clk_hw_data, hws, IMX7D_CLK_END, GFP_KERNEL);
if (WARN_ON(!clk_hw_data))
return;
diff --git a/drivers/clk/imx/clk-imx7ulp.c b/drivers/clk/imx/clk-imx7ulp.c
index f4a48a42637f..322c84d49f44 100644
--- a/drivers/clk/imx/clk-imx7ulp.c
+++ b/drivers/clk/imx/clk-imx7ulp.c
@@ -49,8 +49,8 @@ static void __init imx7ulp_clk_scg1_init(struct device_node *np)
struct clk_hw **hws;
void __iomem *base;
- clk_data = kzalloc(struct_size(clk_data, hws, IMX7ULP_CLK_SCG1_END),
- GFP_KERNEL);
+ clk_data = kzalloc_flex(*clk_data, hws, IMX7ULP_CLK_SCG1_END,
+ GFP_KERNEL);
if (!clk_data)
return;
@@ -138,8 +138,8 @@ static void __init imx7ulp_clk_pcc2_init(struct device_node *np)
struct clk_hw **hws;
void __iomem *base;
- clk_data = kzalloc(struct_size(clk_data, hws, IMX7ULP_CLK_PCC2_END),
- GFP_KERNEL);
+ clk_data = kzalloc_flex(*clk_data, hws, IMX7ULP_CLK_PCC2_END,
+ GFP_KERNEL);
if (!clk_data)
return;
@@ -186,8 +186,8 @@ static void __init imx7ulp_clk_pcc3_init(struct device_node *np)
struct clk_hw **hws;
void __iomem *base;
- clk_data = kzalloc(struct_size(clk_data, hws, IMX7ULP_CLK_PCC3_END),
- GFP_KERNEL);
+ clk_data = kzalloc_flex(*clk_data, hws, IMX7ULP_CLK_PCC3_END,
+ GFP_KERNEL);
if (!clk_data)
return;
@@ -233,8 +233,8 @@ static void __init imx7ulp_clk_smc1_init(struct device_node *np)
struct clk_hw **hws;
void __iomem *base;
- clk_data = kzalloc(struct_size(clk_data, hws, IMX7ULP_CLK_SMC1_END),
- GFP_KERNEL);
+ clk_data = kzalloc_flex(*clk_data, hws, IMX7ULP_CLK_SMC1_END,
+ GFP_KERNEL);
if (!clk_data)
return;
diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c
index 342049b847b9..fb9b199ff289 100644
--- a/drivers/clk/imx/clk-imx8mm.c
+++ b/drivers/clk/imx/clk-imx8mm.c
@@ -303,8 +303,8 @@ static int imx8mm_clocks_probe(struct platform_device *pdev)
void __iomem *base;
int ret;
- clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
- IMX8MM_CLK_END), GFP_KERNEL);
+ clk_hw_data = kzalloc_flex(*clk_hw_data, hws, IMX8MM_CLK_END,
+ GFP_KERNEL);
if (WARN_ON(!clk_hw_data))
return -ENOMEM;
diff --git a/drivers/clk/imx/clk-lpcg-scu.c b/drivers/clk/imx/clk-lpcg-scu.c
index 6376557a3c3d..9e1247bb1edd 100644
--- a/drivers/clk/imx/clk-lpcg-scu.c
+++ b/drivers/clk/imx/clk-lpcg-scu.c
@@ -119,7 +119,7 @@ struct clk_hw *__imx_clk_lpcg_scu(struct device *dev, const char *name,
struct clk_hw *hw;
int ret;
- clk = kzalloc(sizeof(*clk), GFP_KERNEL);
+ clk = kzalloc_obj(*clk, GFP_KERNEL);
if (!clk)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-pfd.c b/drivers/clk/imx/clk-pfd.c
index 31220fa7882b..5222e5ee37d1 100644
--- a/drivers/clk/imx/clk-pfd.c
+++ b/drivers/clk/imx/clk-pfd.c
@@ -132,7 +132,7 @@ struct clk_hw *imx_clk_hw_pfd(const char *name, const char *parent_name,
struct clk_init_data init;
int ret;
- pfd = kzalloc(sizeof(*pfd), GFP_KERNEL);
+ pfd = kzalloc_obj(*pfd, GFP_KERNEL);
if (!pfd)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-pfdv2.c b/drivers/clk/imx/clk-pfdv2.c
index 6ca53a960eb7..ce37a151c745 100644
--- a/drivers/clk/imx/clk-pfdv2.c
+++ b/drivers/clk/imx/clk-pfdv2.c
@@ -210,7 +210,7 @@ struct clk_hw *imx_clk_hw_pfdv2(enum imx_pfdv2_type type, const char *name,
WARN_ON(idx > 3);
- pfd = kzalloc(sizeof(*pfd), GFP_KERNEL);
+ pfd = kzalloc_obj(*pfd, GFP_KERNEL);
if (!pfd)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c
index 36d0e80b55b8..33974d762e4d 100644
--- a/drivers/clk/imx/clk-pll14xx.c
+++ b/drivers/clk/imx/clk-pll14xx.c
@@ -504,7 +504,7 @@ struct clk_hw *imx_dev_clk_hw_pll14xx(struct device *dev, const char *name,
int ret;
u32 val;
- pll = kzalloc(sizeof(*pll), GFP_KERNEL);
+ pll = kzalloc_obj(*pll, GFP_KERNEL);
if (!pll)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-pllv1.c b/drivers/clk/imx/clk-pllv1.c
index 93ee81b28fc7..502f29d44f52 100644
--- a/drivers/clk/imx/clk-pllv1.c
+++ b/drivers/clk/imx/clk-pllv1.c
@@ -119,7 +119,7 @@ struct clk_hw *imx_clk_hw_pllv1(enum imx_pllv1_type type, const char *name,
struct clk_init_data init;
int ret;
- pll = kmalloc(sizeof(*pll), GFP_KERNEL);
+ pll = kmalloc_obj(*pll, GFP_KERNEL);
if (!pll)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-pllv2.c b/drivers/clk/imx/clk-pllv2.c
index bb497ad5e0ae..1faa289b8e69 100644
--- a/drivers/clk/imx/clk-pllv2.c
+++ b/drivers/clk/imx/clk-pllv2.c
@@ -254,7 +254,7 @@ struct clk_hw *imx_clk_hw_pllv2(const char *name, const char *parent,
struct clk_init_data init;
int ret;
- pll = kzalloc(sizeof(*pll), GFP_KERNEL);
+ pll = kzalloc_obj(*pll, GFP_KERNEL);
if (!pll)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c
index b99508367bcb..78d40dad7b4a 100644
--- a/drivers/clk/imx/clk-pllv3.c
+++ b/drivers/clk/imx/clk-pllv3.c
@@ -426,7 +426,7 @@ struct clk_hw *imx_clk_hw_pllv3(enum imx_pllv3_type type, const char *name,
struct clk_init_data init;
int ret;
- pll = kzalloc(sizeof(*pll), GFP_KERNEL);
+ pll = kzalloc_obj(*pll, GFP_KERNEL);
if (!pll)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-pllv4.c b/drivers/clk/imx/clk-pllv4.c
index 01d05b5d5438..d7a4e9ed55b3 100644
--- a/drivers/clk/imx/clk-pllv4.c
+++ b/drivers/clk/imx/clk-pllv4.c
@@ -251,7 +251,7 @@ struct clk_hw *imx_clk_hw_pllv4(enum imx_pllv4_type type, const char *name,
struct clk_init_data init;
int ret;
- pll = kzalloc(sizeof(*pll), GFP_KERNEL);
+ pll = kzalloc_obj(*pll, GFP_KERNEL);
if (!pll)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index 34c9dc1fb20e..9ec9fe99c391 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -457,7 +457,7 @@ struct clk_hw *__imx_clk_scu(struct device *dev, const char *name,
struct clk_hw *hw;
int ret;
- clk = kzalloc(sizeof(*clk), GFP_KERNEL);
+ clk = kzalloc_obj(*clk, GFP_KERNEL);
if (!clk)
return ERR_PTR(-ENOMEM);
@@ -856,7 +856,7 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na
if (rsrc_id >= IMX_SC_R_LAST || gpr_id >= IMX_SC_C_LAST)
return ERR_PTR(-EINVAL);
- clk_node = kzalloc(sizeof(*clk_node), GFP_KERNEL);
+ clk_node = kzalloc_obj(*clk_node, GFP_KERNEL);
if (!clk_node)
return ERR_PTR(-ENOMEM);
@@ -870,7 +870,7 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na
return NULL;
}
- clk = kzalloc(sizeof(*clk), GFP_KERNEL);
+ clk = kzalloc_obj(*clk, GFP_KERNEL);
if (!clk) {
kfree(clk_node);
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk-sscg-pll.c b/drivers/clk/imx/clk-sscg-pll.c
index 81f304fae908..4017b194e085 100644
--- a/drivers/clk/imx/clk-sscg-pll.c
+++ b/drivers/clk/imx/clk-sscg-pll.c
@@ -509,7 +509,7 @@ struct clk_hw *imx_clk_hw_sscg_pll(const char *name,
struct clk_hw *hw;
int ret;
- pll = kzalloc(sizeof(*pll), GFP_KERNEL);
+ pll = kzalloc_obj(*pll, GFP_KERNEL);
if (!pll)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
index df83bd939492..c9c8397e9149 100644
--- a/drivers/clk/imx/clk.c
+++ b/drivers/clk/imx/clk.c
@@ -189,7 +189,7 @@ void imx_register_uart_clocks(void)
if (!of_stdout)
return;
- imx_uart_clocks = kcalloc(num, sizeof(struct clk *), GFP_KERNEL);
+ imx_uart_clocks = kzalloc_objs(struct clk *, num, GFP_KERNEL);
if (!imx_uart_clocks)
return;