diff options
| author | Kees Cook <kees@kernel.org> | 2026-02-20 23:49:23 -0800 |
|---|---|---|
| committer | Kees Cook <kees@kernel.org> | 2026-02-21 01:02:28 -0800 |
| commit | 69050f8d6d075dc01af7a5f2f550a8067510366f (patch) | |
| tree | bb265f94d9dfa7876c06a5d9f88673d496a15341 /drivers/clk | |
| parent | d39a1d7486d98668dd34aaa6732aad7977c45f5a (diff) | |
| download | lwn-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')
252 files changed, 509 insertions, 527 deletions
diff --git a/drivers/clk/aspeed/clk-aspeed.c b/drivers/clk/aspeed/clk-aspeed.c index 74c8c1377b70..c8449e49ea08 100644 --- a/drivers/clk/aspeed/clk-aspeed.c +++ b/drivers/clk/aspeed/clk-aspeed.c @@ -354,7 +354,7 @@ static struct clk_hw *aspeed_clk_hw_register_gate(struct device *dev, struct clk_hw *hw; int ret; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); @@ -698,9 +698,8 @@ static void __init aspeed_cc_init(struct device_node *np) if (!scu_base) return; - aspeed_clk_data = kzalloc(struct_size(aspeed_clk_data, hws, - ASPEED_NUM_CLKS), - GFP_KERNEL); + aspeed_clk_data = kzalloc_flex(*aspeed_clk_data, hws, ASPEED_NUM_CLKS, + GFP_KERNEL); if (!aspeed_clk_data) return; aspeed_clk_data->num = ASPEED_NUM_CLKS; diff --git a/drivers/clk/aspeed/clk-ast2600.c b/drivers/clk/aspeed/clk-ast2600.c index 114afc13d640..e24b536e68ce 100644 --- a/drivers/clk/aspeed/clk-ast2600.c +++ b/drivers/clk/aspeed/clk-ast2600.c @@ -431,7 +431,7 @@ static struct clk_hw *aspeed_g6_clk_hw_register_gate(struct device *dev, struct clk_hw *hw; int ret; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); @@ -838,8 +838,8 @@ static void __init aspeed_g6_cc_init(struct device_node *np) soc_rev = (readl(scu_g6_base + ASPEED_G6_SILICON_REV) & CHIP_REVISION_ID) >> 16; - aspeed_g6_clk_data = kzalloc(struct_size(aspeed_g6_clk_data, hws, - ASPEED_G6_NUM_CLKS), GFP_KERNEL); + aspeed_g6_clk_data = kzalloc_flex(*aspeed_g6_clk_data, hws, + ASPEED_G6_NUM_CLKS, GFP_KERNEL); if (!aspeed_g6_clk_data) return; aspeed_g6_clk_data->num = ASPEED_G6_NUM_CLKS; diff --git a/drivers/clk/aspeed/clk-ast2700.c b/drivers/clk/aspeed/clk-ast2700.c index bbb2b571eb72..df491bae39b7 100644 --- a/drivers/clk/aspeed/clk-ast2700.c +++ b/drivers/clk/aspeed/clk-ast2700.c @@ -820,7 +820,7 @@ static struct clk_hw *ast2700_clk_hw_register_gate(struct device *dev, const cha struct clk_hw *hw; int ret = -EINVAL; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-audio-pll.c b/drivers/clk/at91/clk-audio-pll.c index bf9b635ac9d6..9133c0ec7f08 100644 --- a/drivers/clk/at91/clk-audio-pll.c +++ b/drivers/clk/at91/clk-audio-pll.c @@ -460,7 +460,7 @@ at91_clk_register_audio_pll_frac(struct regmap *regmap, const char *name, struct clk_init_data init = {}; int ret; - frac_ck = kzalloc(sizeof(*frac_ck), GFP_KERNEL); + frac_ck = kzalloc_obj(*frac_ck, GFP_KERNEL); if (!frac_ck) return ERR_PTR(-ENOMEM); @@ -490,7 +490,7 @@ at91_clk_register_audio_pll_pad(struct regmap *regmap, const char *name, struct clk_init_data init; int ret; - apad_ck = kzalloc(sizeof(*apad_ck), GFP_KERNEL); + apad_ck = kzalloc_obj(*apad_ck, GFP_KERNEL); if (!apad_ck) return ERR_PTR(-ENOMEM); @@ -521,7 +521,7 @@ at91_clk_register_audio_pll_pmc(struct regmap *regmap, const char *name, struct clk_init_data init; int ret; - apmc_ck = kzalloc(sizeof(*apmc_ck), GFP_KERNEL); + apmc_ck = kzalloc_obj(*apmc_ck, GFP_KERNEL); if (!apmc_ck) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c index 4b4edeecc889..0427f112829b 100644 --- a/drivers/clk/at91/clk-generated.c +++ b/drivers/clk/at91/clk-generated.c @@ -332,7 +332,7 @@ at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, if (!(parent_names || parent_hws)) return ERR_PTR(-ENOMEM); - gck = kzalloc(sizeof(*gck), GFP_KERNEL); + gck = kzalloc_obj(*gck, GFP_KERNEL); if (!gck) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c index a9aa93b5a870..a56e65eb2333 100644 --- a/drivers/clk/at91/clk-h32mx.c +++ b/drivers/clk/at91/clk-h32mx.c @@ -100,7 +100,7 @@ at91_clk_register_h32mx(struct regmap *regmap, const char *name, struct clk_init_data init; int ret; - h32mxclk = kzalloc(sizeof(*h32mxclk), GFP_KERNEL); + h32mxclk = kzalloc_obj(*h32mxclk, GFP_KERNEL); if (!h32mxclk) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-i2s-mux.c b/drivers/clk/at91/clk-i2s-mux.c index fe6ce172b8b0..309a8d6136d5 100644 --- a/drivers/clk/at91/clk-i2s-mux.c +++ b/drivers/clk/at91/clk-i2s-mux.c @@ -57,7 +57,7 @@ at91_clk_i2s_mux_register(struct regmap *regmap, const char *name, struct clk_i2s_mux *i2s_ck; int ret; - i2s_ck = kzalloc(sizeof(*i2s_ck), GFP_KERNEL); + i2s_ck = kzalloc_obj(*i2s_ck, GFP_KERNEL); if (!i2s_ck) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c index 9b462becc693..51b0421d01e3 100644 --- a/drivers/clk/at91/clk-main.c +++ b/drivers/clk/at91/clk-main.c @@ -163,7 +163,7 @@ at91_clk_register_main_osc(struct regmap *regmap, if (!name || !(parent_name || parent_data)) return ERR_PTR(-EINVAL); - osc = kzalloc(sizeof(*osc), GFP_KERNEL); + osc = kzalloc_obj(*osc, GFP_KERNEL); if (!osc) return ERR_PTR(-ENOMEM); @@ -306,7 +306,7 @@ at91_clk_register_main_rc_osc(struct regmap *regmap, if (!name || !frequency) return ERR_PTR(-EINVAL); - osc = kzalloc(sizeof(*osc), GFP_KERNEL); + osc = kzalloc_obj(*osc, GFP_KERNEL); if (!osc) return ERR_PTR(-ENOMEM); @@ -415,7 +415,7 @@ at91_clk_register_rm9200_main(struct regmap *regmap, if (!(parent_name || parent_hw)) return ERR_PTR(-EINVAL); - clkmain = kzalloc(sizeof(*clkmain), GFP_KERNEL); + clkmain = kzalloc_obj(*clkmain, GFP_KERNEL); if (!clkmain) return ERR_PTR(-ENOMEM); @@ -567,7 +567,7 @@ at91_clk_register_sam9x5_main(struct regmap *regmap, if (!(parent_hws || parent_names) || !num_parents) return ERR_PTR(-EINVAL); - clkmain = kzalloc(sizeof(*clkmain), GFP_KERNEL); + clkmain = kzalloc_obj(*clkmain, GFP_KERNEL); if (!clkmain) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c index d5ea2069ec83..5e4f5fcc0645 100644 --- a/drivers/clk/at91/clk-master.c +++ b/drivers/clk/at91/clk-master.c @@ -488,7 +488,7 @@ at91_clk_register_master_internal(struct regmap *regmap, if (!name || !num_parents || !(parent_names || parent_hws) || !lock) return ERR_PTR(-EINVAL); - master = kzalloc(sizeof(*master), GFP_KERNEL); + master = kzalloc_obj(*master, GFP_KERNEL); if (!master) return ERR_PTR(-ENOMEM); @@ -831,7 +831,7 @@ at91_clk_sama7g5_register_master(struct regmap *regmap, !lock || id > MASTER_MAX_ID) return ERR_PTR(-EINVAL); - master = kzalloc(sizeof(*master), GFP_KERNEL); + master = kzalloc_obj(*master, GFP_KERNEL); if (!master) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c index e7208c47268b..dda4217aaf85 100644 --- a/drivers/clk/at91/clk-peripheral.c +++ b/drivers/clk/at91/clk-peripheral.c @@ -109,7 +109,7 @@ at91_clk_register_peripheral(struct regmap *regmap, const char *name, if (!name || !(parent_name || parent_hw) || id > PERIPHERAL_ID_MAX) return ERR_PTR(-EINVAL); - periph = kzalloc(sizeof(*periph), GFP_KERNEL); + periph = kzalloc_obj(*periph, GFP_KERNEL); if (!periph) return ERR_PTR(-ENOMEM); @@ -471,7 +471,7 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock, if (!name || !(parent_name || parent_hw)) return ERR_PTR(-EINVAL); - periph = kzalloc(sizeof(*periph), GFP_KERNEL); + periph = kzalloc_obj(*periph, GFP_KERNEL); if (!periph) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c index 5c5f7398effe..083e7524ff8f 100644 --- a/drivers/clk/at91/clk-pll.c +++ b/drivers/clk/at91/clk-pll.c @@ -326,7 +326,7 @@ at91_clk_register_pll(struct regmap *regmap, const char *name, if (id > PLL_MAX_ID) return ERR_PTR(-EINVAL); - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-plldiv.c b/drivers/clk/at91/clk-plldiv.c index 3ac09fecc54e..27feb5207b40 100644 --- a/drivers/clk/at91/clk-plldiv.c +++ b/drivers/clk/at91/clk-plldiv.c @@ -91,7 +91,7 @@ at91_clk_register_plldiv(struct regmap *regmap, const char *name, struct clk_init_data init; int ret; - plldiv = kzalloc(sizeof(*plldiv), GFP_KERNEL); + plldiv = kzalloc_obj(*plldiv, GFP_KERNEL); if (!plldiv) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c index 1195fb405503..a87e63f4c3f8 100644 --- a/drivers/clk/at91/clk-programmable.c +++ b/drivers/clk/at91/clk-programmable.c @@ -227,7 +227,7 @@ at91_clk_register_programmable(struct regmap *regmap, if (id > PROG_ID_MAX || !(parent_names || parent_hws)) return ERR_PTR(-EINVAL); - prog = kzalloc(sizeof(*prog), GFP_KERNEL); + prog = kzalloc_obj(*prog, GFP_KERNEL); if (!prog) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-sam9x60-pll.c b/drivers/clk/at91/clk-sam9x60-pll.c index 3b965057ba0d..5f5cecbcf207 100644 --- a/drivers/clk/at91/clk-sam9x60-pll.c +++ b/drivers/clk/at91/clk-sam9x60-pll.c @@ -652,7 +652,7 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock, if (id > PLL_MAX_ID || !lock || !parent_hw) return ERR_PTR(-EINVAL); - frac = kzalloc(sizeof(*frac), GFP_KERNEL); + frac = kzalloc_obj(*frac, GFP_KERNEL); if (!frac) return ERR_PTR(-ENOMEM); @@ -744,7 +744,7 @@ sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock, if (safe_div >= PLL_DIV_MAX) safe_div = PLL_DIV_MAX - 1; - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c index ac9f7a48b76e..e39db89e2a37 100644 --- a/drivers/clk/at91/clk-slow.c +++ b/drivers/clk/at91/clk-slow.c @@ -52,7 +52,7 @@ at91_clk_register_sam9260_slow(struct regmap *regmap, if (!parent_names || !num_parents) return ERR_PTR(-EINVAL); - slowck = kzalloc(sizeof(*slowck), GFP_KERNEL); + slowck = kzalloc_obj(*slowck, GFP_KERNEL); if (!slowck) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c index 09c649c8598e..3c07dcd3cc2c 100644 --- a/drivers/clk/at91/clk-smd.c +++ b/drivers/clk/at91/clk-smd.c @@ -118,7 +118,7 @@ at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name, struct clk_init_data init; int ret; - smd = kzalloc(sizeof(*smd), GFP_KERNEL); + smd = kzalloc_obj(*smd, GFP_KERNEL); if (!smd) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c index 90eed39d0785..c3de1dabf283 100644 --- a/drivers/clk/at91/clk-system.c +++ b/drivers/clk/at91/clk-system.c @@ -116,7 +116,7 @@ at91_clk_register_system(struct regmap *regmap, const char *name, if (!(parent_name || parent_hw) || id > SYSTEM_MAX_ID) return ERR_PTR(-EINVAL); - sys = kzalloc(sizeof(*sys), GFP_KERNEL); + sys = kzalloc_obj(*sys, GFP_KERNEL); if (!sys) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c index e906928cfbf0..e5107d0cf383 100644 --- a/drivers/clk/at91/clk-usb.c +++ b/drivers/clk/at91/clk-usb.c @@ -229,7 +229,7 @@ _at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name, struct clk_init_data init; int ret; - usb = kzalloc(sizeof(*usb), GFP_KERNEL); + usb = kzalloc_obj(*usb, GFP_KERNEL); if (!usb) return ERR_PTR(-ENOMEM); @@ -280,7 +280,7 @@ at91sam9n12_clk_register_usb(struct regmap *regmap, const char *name, struct clk_init_data init; int ret; - usb = kzalloc(sizeof(*usb), GFP_KERNEL); + usb = kzalloc_obj(*usb, GFP_KERNEL); if (!usb) return ERR_PTR(-ENOMEM); @@ -399,7 +399,7 @@ at91rm9200_clk_register_usb(struct regmap *regmap, const char *name, struct clk_init_data init; int ret; - usb = kzalloc(sizeof(*usb), GFP_KERNEL); + usb = kzalloc_obj(*usb, GFP_KERNEL); if (!usb) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/clk-utmi.c b/drivers/clk/at91/clk-utmi.c index b991180beea1..f318c11bbc44 100644 --- a/drivers/clk/at91/clk-utmi.c +++ b/drivers/clk/at91/clk-utmi.c @@ -155,7 +155,7 @@ at91_clk_register_utmi_internal(struct regmap *regmap_pmc, if (!(parent_name || parent_hw)) return ERR_PTR(-EINVAL); - utmi = kzalloc(sizeof(*utmi), GFP_KERNEL); + utmi = kzalloc_obj(*utmi, GFP_KERNEL); if (!utmi) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index f5a5f9ba7634..dddcfcf453a1 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -369,7 +369,7 @@ of_at91_clk_master_get_characteristics(struct device_node *np) { struct clk_master_characteristics *characteristics; - characteristics = kzalloc(sizeof(*characteristics), GFP_KERNEL); + characteristics = kzalloc_obj(*characteristics, GFP_KERNEL); if (!characteristics) return NULL; @@ -568,11 +568,11 @@ of_at91_clk_pll_get_characteristics(struct device_node *np) return NULL; num_output /= num_cells; - characteristics = kzalloc(sizeof(*characteristics), GFP_KERNEL); + characteristics = kzalloc_obj(*characteristics, GFP_KERNEL); if (!characteristics) return NULL; - output = kcalloc(num_output, sizeof(*output), GFP_KERNEL); + output = kzalloc_objs(*output, num_output, GFP_KERNEL); if (!output) goto out_free_characteristics; diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c index 2310f6f73162..261c91d449e7 100644 --- a/drivers/clk/at91/pmc.c +++ b/drivers/clk/at91/pmc.c @@ -87,8 +87,7 @@ struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem, unsigned int num_clks = ncore + nsystem + nperiph + ngck + npck; struct pmc_data *pmc_data; - pmc_data = kzalloc(struct_size(pmc_data, hwtable, num_clks), - GFP_KERNEL); + pmc_data = kzalloc_flex(*pmc_data, hwtable, num_clks, GFP_KERNEL); if (!pmc_data) return NULL; diff --git a/drivers/clk/at91/sckc.c b/drivers/clk/at91/sckc.c index 021d1b412af4..8ce851dc3e3f 100644 --- a/drivers/clk/at91/sckc.c +++ b/drivers/clk/at91/sckc.c @@ -132,7 +132,7 @@ at91_clk_register_slow_osc(void __iomem *sckcr, if (!sckcr || !name || !parent_data) return ERR_PTR(-EINVAL); - osc = kzalloc(sizeof(*osc), GFP_KERNEL); + osc = kzalloc_obj(*osc, GFP_KERNEL); if (!osc) return ERR_PTR(-ENOMEM); @@ -239,7 +239,7 @@ at91_clk_register_slow_rc_osc(void __iomem *sckcr, if (!sckcr || !name) return ERR_PTR(-EINVAL); - osc = kzalloc(sizeof(*osc), GFP_KERNEL); + osc = kzalloc_obj(*osc, GFP_KERNEL); if (!osc) return ERR_PTR(-ENOMEM); @@ -332,7 +332,7 @@ at91_clk_register_sam9x5_slow(void __iomem *sckcr, if (!sckcr || !name || !parent_hws || !num_parents) return ERR_PTR(-EINVAL); - slowck = kzalloc(sizeof(*slowck), GFP_KERNEL); + slowck = kzalloc_obj(*slowck, GFP_KERNEL); if (!slowck) return ERR_PTR(-ENOMEM); @@ -502,7 +502,7 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np) if (IS_ERR(slow_osc)) goto unregister_slow_rc; - clk_data = kzalloc(struct_size(clk_data, hws, 2), GFP_KERNEL); + clk_data = kzalloc_flex(*clk_data, hws, 2, GFP_KERNEL); if (!clk_data) goto unregister_slow_osc; @@ -611,7 +611,7 @@ static void __init of_sama5d4_sckc_setup(struct device_node *np) goto unregister_slow_rc; parent_data.fw_name = xtal_name; - osc = kzalloc(sizeof(*osc), GFP_KERNEL); + osc = kzalloc_obj(*osc, GFP_KERNEL); if (!osc) goto unregister_slow_rc; diff --git a/drivers/clk/axis/clk-artpec6.c b/drivers/clk/axis/clk-artpec6.c index a3f349d4624d..792f00b7c94e 100644 --- a/drivers/clk/axis/clk-artpec6.c +++ b/drivers/clk/axis/clk-artpec6.c @@ -49,7 +49,7 @@ static void of_artpec6_clkctrl_setup(struct device_node *np) sys_refclk_name = of_clk_get_parent_name(np, i); - clkdata = kzalloc(sizeof(*clkdata), GFP_KERNEL); + clkdata = kzalloc_obj(*clkdata, GFP_KERNEL); if (!clkdata) return; diff --git a/drivers/clk/axs10x/pll_clock.c b/drivers/clk/axs10x/pll_clock.c index c7ca473ee76c..594455f0918a 100644 --- a/drivers/clk/axs10x/pll_clock.c +++ b/drivers/clk/axs10x/pll_clock.c @@ -265,7 +265,7 @@ static void __init of_axs10x_pll_clk_setup(struct device_node *node) struct clk_init_data init = { }; int ret; - pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); + pll_clk = kzalloc_obj(*pll_clk, GFP_KERNEL); if (!pll_clk) return; diff --git a/drivers/clk/baikal-t1/ccu-div.c b/drivers/clk/baikal-t1/ccu-div.c index 849d1f55765f..c9dd59b1c551 100644 --- a/drivers/clk/baikal-t1/ccu-div.c +++ b/drivers/clk/baikal-t1/ccu-div.c @@ -447,7 +447,7 @@ static void ccu_div_var_debug_init(struct clk_hw *hw, struct dentry *dentry) num += !!(div->flags & CLK_SET_RATE_GATE) + !!(div->features & CCU_DIV_RESET_DOMAIN); - bits = kcalloc(num, sizeof(*bits), GFP_KERNEL); + bits = kzalloc_objs(*bits, num, GFP_KERNEL); if (!bits) return; @@ -489,7 +489,7 @@ static void ccu_div_gate_debug_init(struct clk_hw *hw, struct dentry *dentry) struct ccu_div *div = to_ccu_div(hw); struct ccu_div_dbgfs_bit *bit; - bit = kmalloc(sizeof(*bit), GFP_KERNEL); + bit = kmalloc_obj(*bit, GFP_KERNEL); if (!bit) return; @@ -507,7 +507,7 @@ static void ccu_div_buf_debug_init(struct clk_hw *hw, struct dentry *dentry) struct ccu_div *div = to_ccu_div(hw); struct ccu_div_dbgfs_bit *bit; - bit = kmalloc(sizeof(*bit), GFP_KERNEL); + bit = kmalloc_obj(*bit, GFP_KERNEL); if (!bit) return; @@ -585,7 +585,7 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init) if (!div_init) return ERR_PTR(-EINVAL); - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/baikal-t1/ccu-pll.c b/drivers/clk/baikal-t1/ccu-pll.c index 357269f41cdc..02b3390cf87f 100644 --- a/drivers/clk/baikal-t1/ccu-pll.c +++ b/drivers/clk/baikal-t1/ccu-pll.c @@ -445,7 +445,7 @@ static void ccu_pll_debug_init(struct clk_hw *hw, struct dentry *dentry) struct ccu_pll_dbgfs_fld *flds; int idx; - bits = kcalloc(CCU_PLL_DBGFS_BIT_NUM, sizeof(*bits), GFP_KERNEL); + bits = kzalloc_objs(*bits, CCU_PLL_DBGFS_BIT_NUM, GFP_KERNEL); if (!bits) return; @@ -458,7 +458,7 @@ static void ccu_pll_debug_init(struct clk_hw *hw, struct dentry *dentry) &ccu_pll_dbgfs_bit_fops); } - flds = kcalloc(CCU_PLL_DBGFS_FLD_NUM, sizeof(*flds), GFP_KERNEL); + flds = kzalloc_objs(*flds, CCU_PLL_DBGFS_FLD_NUM, GFP_KERNEL); if (!flds) return; @@ -508,7 +508,7 @@ struct ccu_pll *ccu_pll_hw_register(const struct ccu_pll_init_data *pll_init) if (!pll_init) return ERR_PTR(-EINVAL); - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/baikal-t1/ccu-rst.c b/drivers/clk/baikal-t1/ccu-rst.c index 40023ea67463..18a60273a174 100644 --- a/drivers/clk/baikal-t1/ccu-rst.c +++ b/drivers/clk/baikal-t1/ccu-rst.c @@ -172,7 +172,7 @@ struct ccu_rst *ccu_rst_hw_register(const struct ccu_rst_init_data *rst_init) if (!rst_init) return ERR_PTR(-EINVAL); - rst = kzalloc(sizeof(*rst), GFP_KERNEL); + rst = kzalloc_obj(*rst, GFP_KERNEL); if (!rst) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/baikal-t1/clk-ccu-div.c b/drivers/clk/baikal-t1/clk-ccu-div.c index 17d75e8e2e8f..addccc4014f9 100644 --- a/drivers/clk/baikal-t1/clk-ccu-div.c +++ b/drivers/clk/baikal-t1/clk-ccu-div.c @@ -271,7 +271,7 @@ static struct ccu_div_data *ccu_div_create_data(struct device_node *np) struct ccu_div_data *data; int ret; - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = kzalloc_obj(*data, GFP_KERNEL); if (!data) return ERR_PTR(-ENOMEM); @@ -289,7 +289,7 @@ static struct ccu_div_data *ccu_div_create_data(struct device_node *np) goto err_kfree_data; } - data->divs = kcalloc(data->divs_num, sizeof(*data->divs), GFP_KERNEL); + data->divs = kzalloc_objs(*data->divs, data->divs_num, GFP_KERNEL); if (!data->divs) { ret = -ENOMEM; goto err_kfree_data; diff --git a/drivers/clk/baikal-t1/clk-ccu-pll.c b/drivers/clk/baikal-t1/clk-ccu-pll.c index 921b87024feb..ace46b60497e 100644 --- a/drivers/clk/baikal-t1/clk-ccu-pll.c +++ b/drivers/clk/baikal-t1/clk-ccu-pll.c @@ -100,7 +100,7 @@ static struct ccu_pll_data *ccu_pll_create_data(struct device_node *np) { struct ccu_pll_data *data; - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = kzalloc_obj(*data, GFP_KERNEL); if (!data) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index 02215ea79403..971131677b5a 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -1357,7 +1357,7 @@ static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman, init.ops = &bcm2835_pll_clk_ops; init.flags = pll_data->flags | CLK_IGNORE_UNUSED; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return NULL; diff --git a/drivers/clk/bcm/clk-bcm53573-ilp.c b/drivers/clk/bcm/clk-bcm53573-ilp.c index b2fc05b60783..e12a5384b95f 100644 --- a/drivers/clk/bcm/clk-bcm53573-ilp.c +++ b/drivers/clk/bcm/clk-bcm53573-ilp.c @@ -102,7 +102,7 @@ static void bcm53573_ilp_init(struct device_node *np) const char *parent_name; int err; - ilp = kzalloc(sizeof(*ilp), GFP_KERNEL); + ilp = kzalloc_obj(*ilp, GFP_KERNEL); if (!ilp) return; diff --git a/drivers/clk/bcm/clk-iproc-armpll.c b/drivers/clk/bcm/clk-iproc-armpll.c index 9e86c0c10b57..e08e828666ea 100644 --- a/drivers/clk/bcm/clk-iproc-armpll.c +++ b/drivers/clk/bcm/clk-iproc-armpll.c @@ -238,7 +238,7 @@ void __init iproc_armpll_setup(struct device_node *node) struct clk_init_data init; const char *parent_name; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (WARN_ON(!pll)) return; diff --git a/drivers/clk/bcm/clk-iproc-asiu.c b/drivers/clk/bcm/clk-iproc-asiu.c index 83ec13da9b2e..258c6b2921bd 100644 --- a/drivers/clk/bcm/clk-iproc-asiu.c +++ b/drivers/clk/bcm/clk-iproc-asiu.c @@ -188,17 +188,17 @@ void __init iproc_asiu_setup(struct device_node *node, if (WARN_ON(!gate || !div)) return; - asiu = kzalloc(sizeof(*asiu), GFP_KERNEL); + asiu = kzalloc_obj(*asiu, GFP_KERNEL); if (WARN_ON(!asiu)) return; - asiu->clk_data = kzalloc(struct_size(asiu->clk_data, hws, num_clks), - GFP_KERNEL); + asiu->clk_data = kzalloc_flex(*asiu->clk_data, hws, num_clks, + GFP_KERNEL); if (WARN_ON(!asiu->clk_data)) goto err_clks; asiu->clk_data->num = num_clks; - asiu->clks = kcalloc(num_clks, sizeof(*asiu->clks), GFP_KERNEL); + asiu->clks = kzalloc_objs(*asiu->clks, num_clks, GFP_KERNEL); if (WARN_ON(!asiu->clks)) goto err_asiu_clks; diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c index 680f9d8d357c..3eab95a59b50 100644 --- a/drivers/clk/bcm/clk-iproc-pll.c +++ b/drivers/clk/bcm/clk-iproc-pll.c @@ -731,16 +731,16 @@ void iproc_pll_clk_setup(struct device_node *node, if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl)) return; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (WARN_ON(!pll)) return; - clk_data = kzalloc(struct_size(clk_data, hws, num_clks), GFP_KERNEL); + clk_data = kzalloc_flex(*clk_data, hws, num_clks, GFP_KERNEL); if (WARN_ON(!clk_data)) goto err_clk_data; clk_data->num = num_clks; - iclk_array = kcalloc(num_clks, sizeof(struct iproc_clk), GFP_KERNEL); + iclk_array = kzalloc_objs(struct iproc_clk, num_clks, GFP_KERNEL); if (WARN_ON(!iclk_array)) goto err_clks; diff --git a/drivers/clk/berlin/berlin2-avpll.c b/drivers/clk/berlin/berlin2-avpll.c index 79f3d37a0ee0..4c5881baf027 100644 --- a/drivers/clk/berlin/berlin2-avpll.c +++ b/drivers/clk/berlin/berlin2-avpll.c @@ -184,7 +184,7 @@ int __init berlin2_avpll_vco_register(void __iomem *base, struct berlin2_avpll_vco *vco; struct clk_init_data init; - vco = kzalloc(sizeof(*vco), GFP_KERNEL); + vco = kzalloc_obj(*vco, GFP_KERNEL); if (!vco) return -ENOMEM; @@ -360,7 +360,7 @@ int __init berlin2_avpll_channel_register(void __iomem *base, struct berlin2_avpll_channel *ch; struct clk_init_data init; - ch = kzalloc(sizeof(*ch), GFP_KERNEL); + ch = kzalloc_obj(*ch, GFP_KERNEL); if (!ch) return -ENOMEM; diff --git a/drivers/clk/berlin/berlin2-div.c b/drivers/clk/berlin/berlin2-div.c index 0a248bfe2193..6498823133c0 100644 --- a/drivers/clk/berlin/berlin2-div.c +++ b/drivers/clk/berlin/berlin2-div.c @@ -236,7 +236,7 @@ berlin2_div_register(const struct berlin2_div_map *map, const struct clk_ops *gate_ops = &berlin2_div_gate_ops; struct berlin2_div *div; - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/berlin/berlin2-pll.c b/drivers/clk/berlin/berlin2-pll.c index 9661820717a5..6557b275a718 100644 --- a/drivers/clk/berlin/berlin2-pll.c +++ b/drivers/clk/berlin/berlin2-pll.c @@ -81,7 +81,7 @@ berlin2_pll_register(const struct berlin2_pll_map *map, struct clk_init_data init; struct berlin2_pll *pll; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return -ENOMEM; diff --git a/drivers/clk/berlin/bg2.c b/drivers/clk/berlin/bg2.c index 67a9edbba29c..9a08a16b2026 100644 --- a/drivers/clk/berlin/bg2.c +++ b/drivers/clk/berlin/bg2.c @@ -499,7 +499,7 @@ static void __init berlin2_clock_setup(struct device_node *np) u8 avpll_flags = 0; int n, ret; - clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); + clk_data = kzalloc_flex(*clk_data, hws, MAX_CLKS, GFP_KERNEL); if (!clk_data) { of_node_put(parent_np); return; diff --git a/drivers/clk/berlin/bg2q.c b/drivers/clk/berlin/bg2q.c index dd2784bb75b6..58611495ae1d 100644 --- a/drivers/clk/berlin/bg2q.c +++ b/drivers/clk/berlin/bg2q.c @@ -285,7 +285,7 @@ static void __init berlin2q_clock_setup(struct device_node *np) struct clk_hw **hws; int n, ret; - clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); + clk_data = kzalloc_flex(*clk_data, hws, MAX_CLKS, GFP_KERNEL); if (!clk_data) { of_node_put(parent_np); return; diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c index 595cfa533fb9..08e69d69d1fb 100644 --- a/drivers/clk/clk-asm9260.c +++ b/drivers/clk/clk-asm9260.c @@ -262,7 +262,7 @@ static void __init asm9260_acc_init(struct device_node *np) u32 rate; int n; - clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); + clk_data = kzalloc_flex(*clk_data, hws, MAX_CLKS, GFP_KERNEL); if (!clk_data) return; clk_data->num = MAX_CLKS; diff --git a/drivers/clk/clk-bm1880.c b/drivers/clk/clk-bm1880.c index 1bdceb36fa87..47c64f16e129 100644 --- a/drivers/clk/clk-bm1880.c +++ b/drivers/clk/clk-bm1880.c @@ -764,7 +764,7 @@ static struct clk_hw *bm1880_clk_register_composite(struct bm1880_composite_cloc int ret; if (clks->mux_shift >= 0) { - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return ERR_PTR(-ENOMEM); @@ -784,7 +784,7 @@ static struct clk_hw *bm1880_clk_register_composite(struct bm1880_composite_cloc } if (clks->gate_shift >= 0) { - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) { ret = -ENOMEM; goto err_out; @@ -799,7 +799,7 @@ static struct clk_hw *bm1880_clk_register_composite(struct bm1880_composite_cloc } if (clks->div_shift >= 0) { - div_hws = kzalloc(sizeof(*div_hws), GFP_KERNEL); + div_hws = kzalloc_obj(*div_hws, GFP_KERNEL); if (!div_hws) { ret = -ENOMEM; goto err_out; diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c index 826b3ff99433..1039cf038850 100644 --- a/drivers/clk/clk-bulk.c +++ b/drivers/clk/clk-bulk.c @@ -54,7 +54,7 @@ static int __must_check of_clk_bulk_get_all(struct device_node *np, if (!num_clks) return 0; - clk_bulk = kmalloc_array(num_clks, sizeof(*clk_bulk), GFP_KERNEL); + clk_bulk = kmalloc_objs(*clk_bulk, num_clks, GFP_KERNEL); if (!clk_bulk) return -ENOMEM; diff --git a/drivers/clk/clk-clps711x.c b/drivers/clk/clk-clps711x.c index 402ab74d9bfb..babe42e59533 100644 --- a/drivers/clk/clk-clps711x.c +++ b/drivers/clk/clk-clps711x.c @@ -53,9 +53,8 @@ static void __init clps711x_clk_init_dt(struct device_node *np) base = of_iomap(np, 0); BUG_ON(!base); - clps711x_clk = kzalloc(struct_size(clps711x_clk, clk_data.hws, - CLPS711X_CLK_MAX), - GFP_KERNEL); + clps711x_clk = kzalloc_flex(*clps711x_clk, clk_data.hws, + CLPS711X_CLK_MAX, GFP_KERNEL); BUG_ON(!clps711x_clk); spin_lock_init(&clps711x_clk->lock); diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c index 66759fe28fad..20e45856e8d6 100644 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c @@ -248,7 +248,7 @@ static struct clk_hw *__clk_hw_register_composite(struct device *dev, struct clk_ops *clk_composite_ops; int ret; - composite = kzalloc(sizeof(*composite), GFP_KERNEL); + composite = kzalloc_obj(*composite, GFP_KERNEL); if (!composite) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 2601b6155afb..e91bcdb092db 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -538,7 +538,7 @@ struct clk_hw *__clk_hw_register_divider(struct device *dev, } /* allocate the divider */ - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/clk-eyeq.c b/drivers/clk/clk-eyeq.c index ea1c3d78e7cd..a41f8706df18 100644 --- a/drivers/clk/clk-eyeq.c +++ b/drivers/clk/clk-eyeq.c @@ -335,7 +335,7 @@ static int eqc_auxdev_create(struct device *dev, void __iomem *base, struct auxiliary_device *adev; int ret; - adev = kzalloc(sizeof(*adev), GFP_KERNEL); + adev = kzalloc_obj(*adev, GFP_KERNEL); if (!adev) return -ENOMEM; @@ -400,7 +400,7 @@ static int eqc_probe(struct platform_device *pdev) clk_count = data->pll_count + data->div_count + data->fixed_factor_count + data->early_clk_count; - cells = kzalloc(struct_size(cells, hws, clk_count), GFP_KERNEL); + cells = kzalloc_flex(*cells, hws, clk_count, GFP_KERNEL); if (!cells) return -ENOMEM; @@ -738,7 +738,7 @@ static void __init eqc_early_init(struct device_node *np, clk_count = early_data->early_pll_count + early_data->early_fixed_factor_count + early_data->late_clk_count; - cells = kzalloc(struct_size(cells, hws, clk_count), GFP_KERNEL); + cells = kzalloc_flex(*cells, hws, clk_count, GFP_KERNEL); if (!cells) { ret = -ENOMEM; goto err; diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index de658c9e4c53..40cfb6af38bb 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -110,7 +110,7 @@ __clk_hw_register_fixed_factor(struct device *dev, struct device_node *np, fix = devres_alloc(devm_clk_hw_register_fixed_factor_release, sizeof(*fix), GFP_KERNEL); else - fix = kmalloc(sizeof(*fix), GFP_KERNEL); + fix = kmalloc_obj(*fix, GFP_KERNEL); if (!fix) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c index 6b4f76b9c4da..ef48ee88df46 100644 --- a/drivers/clk/clk-fixed-rate.c +++ b/drivers/clk/clk-fixed-rate.c @@ -78,7 +78,7 @@ struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev, fixed = devres_alloc(devm_clk_hw_register_fixed_rate_release, sizeof(*fixed), GFP_KERNEL); else - fixed = kzalloc(sizeof(*fixed), GFP_KERNEL); + fixed = kzalloc_obj(*fixed, GFP_KERNEL); if (!fixed) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fractional-divider.c index cd36a6e27f25..065ceb9b3a49 100644 --- a/drivers/clk/clk-fractional-divider.c +++ b/drivers/clk/clk-fractional-divider.c @@ -275,7 +275,7 @@ struct clk_hw *clk_hw_register_fractional_divider(struct device *dev, struct clk_hw *hw; int ret; - fd = kzalloc(sizeof(*fd), GFP_KERNEL); + fd = kzalloc_obj(*fd, GFP_KERNEL); if (!fd) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index 4746f8219132..0c5cbb3f3e75 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -145,7 +145,7 @@ struct clk_hw *__clk_hw_register_gate(struct device *dev, } /* allocate the gate */ - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/clk-gemini.c b/drivers/clk/clk-gemini.c index e94589c38568..877db2e6efd1 100644 --- a/drivers/clk/clk-gemini.c +++ b/drivers/clk/clk-gemini.c @@ -197,7 +197,7 @@ static struct clk_hw *gemini_pci_clk_setup(const char *name, struct clk_init_data init; int ret; - pciclk = kzalloc(sizeof(*pciclk), GFP_KERNEL); + pciclk = kzalloc_obj(*pciclk, GFP_KERNEL); if (!pciclk) return ERR_PTR(-ENOMEM); @@ -398,9 +398,8 @@ static void __init gemini_cc_init(struct device_node *np) int ret; int i; - gemini_clk_data = kzalloc(struct_size(gemini_clk_data, hws, - GEMINI_NUM_CLKS), - GFP_KERNEL); + gemini_clk_data = kzalloc_flex(*gemini_clk_data, hws, GEMINI_NUM_CLKS, + GFP_KERNEL); if (!gemini_clk_data) return; gemini_clk_data->num = GEMINI_NUM_CLKS; diff --git a/drivers/clk/clk-highbank.c b/drivers/clk/clk-highbank.c index cc583934ecf2..2642314b4735 100644 --- a/drivers/clk/clk-highbank.c +++ b/drivers/clk/clk-highbank.c @@ -277,7 +277,7 @@ static void __init hb_clk_init(struct device_node *node, const struct clk_ops *o if (WARN_ON(rc)) return; - hb_clk = kzalloc(sizeof(*hb_clk), GFP_KERNEL); + hb_clk = kzalloc_obj(*hb_clk, GFP_KERNEL); if (WARN_ON(!hb_clk)) return; diff --git a/drivers/clk/clk-hsdk-pll.c b/drivers/clk/clk-hsdk-pll.c index 7d56a47c2aa7..0ea108366136 100644 --- a/drivers/clk/clk-hsdk-pll.c +++ b/drivers/clk/clk-hsdk-pll.c @@ -357,7 +357,7 @@ static void __init of_hsdk_pll_clk_setup(struct device_node *node) struct hsdk_pll_clk *pll_clk; struct clk_init_data init = { }; - pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); + pll_clk = kzalloc_obj(*pll_clk, GFP_KERNEL); if (!pll_clk) return; diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c index 7b7329a907ab..ffcb4e1b3488 100644 --- a/drivers/clk/clk-k210.c +++ b/drivers/clk/clk-k210.c @@ -893,7 +893,7 @@ static void __init k210_clk_init(struct device_node *np) struct k210_sysclk *ksc; int i, ret; - ksc = kzalloc(sizeof(*ksc), GFP_KERNEL); + ksc = kzalloc_obj(*ksc, GFP_KERNEL); if (!ksc) return; diff --git a/drivers/clk/clk-milbeaut.c b/drivers/clk/clk-milbeaut.c index 45389db652e0..6a27411c9f9f 100644 --- a/drivers/clk/clk-milbeaut.c +++ b/drivers/clk/clk-milbeaut.c @@ -333,7 +333,7 @@ static struct clk_hw *m10v_clk_hw_register_mux(struct device *dev, struct clk_init_data init; int ret; - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return ERR_PTR(-ENOMEM); @@ -464,7 +464,7 @@ static struct clk_hw *m10v_clk_hw_register_divider(struct device *dev, struct clk_init_data init; int ret; - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return ERR_PTR(-ENOMEM); @@ -611,9 +611,8 @@ static void __init m10v_cc_init(struct device_node *np) const char *parent_name; struct clk_hw *hw; - m10v_clk_data = kzalloc(struct_size(m10v_clk_data, hws, - M10V_NUM_CLKS), - GFP_KERNEL); + m10v_clk_data = kzalloc_flex(*m10v_clk_data, hws, M10V_NUM_CLKS, + GFP_KERNEL); if (!m10v_clk_data) return; diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index fa817c317c2a..ee4a7065817f 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -169,7 +169,7 @@ struct clk_hw *__clk_hw_register_mux(struct device *dev, struct device_node *np, } /* allocate the mux */ - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c index fc0aeb4247f2..d165ef6f320d 100644 --- a/drivers/clk/clk-nomadik.c +++ b/drivers/clk/clk-nomadik.c @@ -270,7 +270,7 @@ pll_clk_register(struct device *dev, const char *name, return ERR_PTR(-EINVAL); } - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); @@ -357,7 +357,7 @@ src_clk_register(struct device *dev, const char *name, struct clk_src *sclk; struct clk_init_data init; - sclk = kzalloc(sizeof(*sclk), GFP_KERNEL); + sclk = kzalloc_obj(*sclk, GFP_KERNEL); if (!sclk) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/clk-npcm7xx.c b/drivers/clk/clk-npcm7xx.c index 030186def9c6..e02f3f1d5ea7 100644 --- a/drivers/clk/clk-npcm7xx.c +++ b/drivers/clk/clk-npcm7xx.c @@ -74,7 +74,7 @@ npcm7xx_clk_register_pll(void __iomem *pllcon, 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); @@ -421,8 +421,8 @@ static void __init npcm7xx_clk_init(struct device_node *clk_np) if (!clk_base) goto npcm7xx_init_error; - npcm7xx_clk_data = kzalloc(struct_size(npcm7xx_clk_data, hws, - NPCM7XX_NUM_CLOCKS), GFP_KERNEL); + npcm7xx_clk_data = kzalloc_flex(*npcm7xx_clk_data, hws, + NPCM7XX_NUM_CLOCKS, GFP_KERNEL); if (!npcm7xx_clk_data) goto npcm7xx_init_np_err; diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index a560edeb4b55..c1e0b0a80da7 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -976,7 +976,7 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx) u64 max_rate, pct80_rate; u32 clksel; - hwc = kzalloc(sizeof(*hwc), GFP_KERNEL); + hwc = kzalloc_obj(*hwc, GFP_KERNEL); if (!hwc) return NULL; @@ -1020,7 +1020,7 @@ static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx) { struct mux_hwclock *hwc; - hwc = kzalloc(sizeof(*hwc), GFP_KERNEL); + hwc = kzalloc_obj(*hwc, GFP_KERNEL); if (!hwc) return NULL; @@ -1319,11 +1319,11 @@ static void __init legacy_pll_init(struct device_node *np, int idx) count = of_property_count_strings(np, "clock-output-names"); BUILD_BUG_ON(ARRAY_SIZE(pll->div) < 4); - subclks = kcalloc(4, sizeof(struct clk *), GFP_KERNEL); + subclks = kzalloc_objs(struct clk *, 4, GFP_KERNEL); if (!subclks) return; - onecell_data = kmalloc(sizeof(*onecell_data), GFP_KERNEL); + onecell_data = kmalloc_obj(*onecell_data, GFP_KERNEL); if (!onecell_data) goto err_clks; diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c index b5d4d48432a0..4e518b92797b 100644 --- a/drivers/clk/clk-stm32f4.c +++ b/drivers/clk/clk-stm32f4.c @@ -489,7 +489,7 @@ static struct clk *clk_register_apb_mul(struct device *dev, const char *name, struct clk_init_data init; struct clk *clk; - am = kzalloc(sizeof(*am), GFP_KERNEL); + am = kzalloc_obj(*am, GFP_KERNEL); if (!am) return ERR_PTR(-ENOMEM); @@ -815,7 +815,7 @@ static struct clk_hw *clk_register_pll_div(const char *name, int ret; /* allocate the divider */ - pll_div = kzalloc(sizeof(*pll_div), GFP_KERNEL); + pll_div = kzalloc_obj(*pll_div, GFP_KERNEL); if (!pll_div) return ERR_PTR(-ENOMEM); @@ -937,7 +937,7 @@ static struct clk_hw *stm32f4_rcc_register_pll(const char *pllsrc, const struct stm32f4_vco_data *vco; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); @@ -1107,7 +1107,7 @@ static struct clk_hw *clk_register_rgate(struct device *dev, const char *name, struct clk_hw *hw; int ret; - rgate = kzalloc(sizeof(*rgate), GFP_KERNEL); + rgate = kzalloc_obj(*rgate, GFP_KERNEL); if (!rgate) return ERR_PTR(-ENOMEM); @@ -1202,13 +1202,13 @@ static struct clk_hw *stm32_register_cclk(struct device *dev, const char *name, struct clk_gate *gate; struct clk_mux *mux; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) { hw = ERR_PTR(-EINVAL); goto fail; } - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) { kfree(gate); hw = ERR_PTR(-EINVAL); @@ -1776,7 +1776,7 @@ static struct clk_hw *stm32_register_aux_clk(const char *name, const struct clk_ops *mux_ops = NULL, *gate_ops = NULL; if (offset_gate != NO_GATE) { - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) { hw = ERR_PTR(-EINVAL); goto fail; @@ -1791,7 +1791,7 @@ static struct clk_hw *stm32_register_aux_clk(const char *name, } if (offset_mux != NO_MUX) { - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) { hw = ERR_PTR(-EINVAL); goto fail; @@ -1855,8 +1855,8 @@ static void __init stm32f4_rcc_init(struct device_node *np) stm32fx_end_primary_clk = data->end_primary; - clks = kmalloc_array(data->gates_num + stm32fx_end_primary_clk, - sizeof(*clks), GFP_KERNEL); + clks = kmalloc_objs(*clks, data->gates_num + stm32fx_end_primary_clk, + GFP_KERNEL); if (!clks) goto fail; diff --git a/drivers/clk/clk-stm32h7.c b/drivers/clk/clk-stm32h7.c index 04c18a1d45d3..66fd934070b7 100644 --- a/drivers/clk/clk-stm32h7.c +++ b/drivers/clk/clk-stm32h7.c @@ -222,7 +222,7 @@ static struct clk_hw *clk_register_ready_gate(struct device *dev, struct clk_hw *hw; int ret; - rgate = kzalloc(sizeof(*rgate), GFP_KERNEL); + rgate = kzalloc_obj(*rgate, GFP_KERNEL); if (!rgate) return ERR_PTR(-ENOMEM); @@ -297,7 +297,7 @@ static struct clk_mux *_get_cmux(void __iomem *reg, u8 shift, u8 width, { struct clk_mux *mux; - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return ERR_PTR(-ENOMEM); @@ -315,7 +315,7 @@ static struct clk_divider *_get_cdiv(void __iomem *reg, u8 shift, u8 width, { struct clk_divider *div; - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return ERR_PTR(-ENOMEM); @@ -334,7 +334,7 @@ static struct clk_gate *_get_cgate(void __iomem *reg, u8 bit_idx, u32 flags, { struct clk_gate *gate; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); @@ -467,7 +467,7 @@ static struct clk_hw *clk_register_stm32_timer_ker(struct device *dev, struct clk_hw *hw; int err; - element = kzalloc(sizeof(*element), GFP_KERNEL); + element = kzalloc_obj(*element, GFP_KERNEL); if (!element) return ERR_PTR(-ENOMEM); @@ -792,7 +792,7 @@ static struct clk_hw *clk_register_stm32_pll(struct device *dev, struct stm32_fractional_divider *div = NULL; struct stm32_ready_gate *rgate; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); @@ -1200,8 +1200,7 @@ static void __init stm32h7_rcc_init(struct device_node *np) const char *hse_clk, *lse_clk, *i2s_clk; struct regmap *pdrm; - clk_data = kzalloc(struct_size(clk_data, hws, STM32H7_MAX_CLKS), - GFP_KERNEL); + clk_data = kzalloc_flex(*clk_data, hws, STM32H7_MAX_CLKS, GFP_KERNEL); if (!clk_data) return; diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index eae5b3fbfb82..6065141750af 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -235,7 +235,7 @@ static __init void vtwm_device_clk_init(struct device_node *node) if (!pmc_base) vtwm_set_pmc_base(); - dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL); + dev_clk = kzalloc_obj(*dev_clk, GFP_KERNEL); if (WARN_ON(!dev_clk)) return; @@ -698,7 +698,7 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type) if (WARN_ON(rc)) return; - pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); + pll_clk = kzalloc_obj(*pll_clk, GFP_KERNEL); if (WARN_ON(!pll_clk)) return; diff --git a/drivers/clk/clk-xgene.c b/drivers/clk/clk-xgene.c index 92e39f3237c2..ebf47b1f5433 100644 --- a/drivers/clk/clk-xgene.c +++ b/drivers/clk/clk-xgene.c @@ -131,7 +131,7 @@ static struct clk *xgene_register_clk_pll(struct device *dev, struct clk_init_data init; /* allocate the APM clock structure */ - apmclk = kzalloc(sizeof(*apmclk), GFP_KERNEL); + apmclk = kzalloc_obj(*apmclk, GFP_KERNEL); if (!apmclk) return ERR_PTR(-ENOMEM); @@ -352,7 +352,7 @@ xgene_register_clk_pmd(struct device *dev, struct clk_init_data init; struct clk *clk; - fd = kzalloc(sizeof(*fd), GFP_KERNEL); + fd = kzalloc_obj(*fd, GFP_KERNEL); if (!fd) return ERR_PTR(-ENOMEM); @@ -638,7 +638,7 @@ static struct clk *xgene_register_clk(struct device *dev, int rc; /* allocate the APM clock structure */ - apmclk = kzalloc(sizeof(*apmclk), GFP_KERNEL); + apmclk = kzalloc_obj(*apmclk, GFP_KERNEL); if (!apmclk) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 85d2f2481acf..5789cd93bfc2 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -4121,7 +4121,7 @@ static struct clk *alloc_clk(struct clk_core *core, const char *dev_id, { struct clk *clk; - clk = kzalloc(sizeof(*clk), GFP_KERNEL); + clk = kzalloc_obj(*clk, GFP_KERNEL); if (!clk) return ERR_PTR(-ENOMEM); @@ -4238,7 +4238,7 @@ static int clk_core_populate_parent_map(struct clk_core *core, * Avoid unnecessary string look-ups of clk_core's possible parents by * having a cache of names/clk_hw pointers to clk_core pointers. */ - parents = kcalloc(num_parents, sizeof(*parents), GFP_KERNEL); + parents = kzalloc_objs(*parents, num_parents, GFP_KERNEL); core->parents = parents; if (!parents) return -ENOMEM; @@ -4328,7 +4328,7 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw) */ hw->init = NULL; - core = kzalloc(sizeof(*core), GFP_KERNEL); + core = kzalloc_obj(*core, GFP_KERNEL); if (!core) { ret = -ENOMEM; goto fail_out; @@ -4813,7 +4813,7 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb) goto found; /* if clk wasn't in the notifier list, allocate new clk_notifier */ - cn = kzalloc(sizeof(*cn), GFP_KERNEL); + cn = kzalloc_obj(*cn, GFP_KERNEL); if (!cn) goto out; @@ -5009,7 +5009,7 @@ int of_clk_add_provider(struct device_node *np, if (!np) return 0; - cp = kzalloc(sizeof(*cp), GFP_KERNEL); + cp = kzalloc_obj(*cp, GFP_KERNEL); if (!cp) return -ENOMEM; @@ -5051,7 +5051,7 @@ int of_clk_add_hw_provider(struct device_node *np, if (!np) return 0; - cp = kzalloc(sizeof(*cp), GFP_KERNEL); + cp = kzalloc_obj(*cp, GFP_KERNEL); if (!cp) return -ENOMEM; @@ -5548,7 +5548,7 @@ void __init of_clk_init(const struct of_device_id *matches) if (!of_device_is_available(np)) continue; - parent = kzalloc(sizeof(*parent), GFP_KERNEL); + parent = kzalloc_obj(*parent, GFP_KERNEL); if (!parent) { list_for_each_entry_safe(clk_provider, next, &clk_provider_list, node) { diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index e0bede6350e1..4d1dbd9fb807 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -164,7 +164,7 @@ vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt, size_t max_size; ssize_t res; - cla = kzalloc(sizeof(*cla), GFP_KERNEL); + cla = kzalloc_obj(*cla, GFP_KERNEL); if (!cla) return NULL; diff --git a/drivers/clk/davinci/pll.c b/drivers/clk/davinci/pll.c index bfb6bbdc036c..eda3c3a45c52 100644 --- a/drivers/clk/davinci/pll.c +++ b/drivers/clk/davinci/pll.c @@ -243,14 +243,14 @@ static struct clk *davinci_pll_div_register(struct device *dev, struct clk *clk; int ret; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); gate->reg = reg; gate->bit_idx = DIV_ENABLE_SHIFT; - divider = kzalloc(sizeof(*divider), GFP_KERNEL); + divider = kzalloc_obj(*divider, GFP_KERNEL); if (!divider) { ret = -ENOMEM; goto err_free_gate; @@ -433,7 +433,7 @@ struct clk *davinci_pll_clk_register(struct device *dev, info->unlock_mask, 0); } - pllout = kzalloc(sizeof(*pllout), GFP_KERNEL); + pllout = kzalloc_obj(*pllout, GFP_KERNEL); if (!pllout) { ret = -ENOMEM; goto err_unregister_prediv; @@ -489,7 +489,7 @@ struct clk *davinci_pll_clk_register(struct device *dev, parent_name = postdiv_name; } - pllen = kzalloc(sizeof(*pllen), GFP_KERNEL); + pllen = kzalloc_obj(*pllen, GFP_KERNEL); if (!pllen) { ret = -ENOMEM; goto err_unregister_postdiv; @@ -579,7 +579,7 @@ davinci_pll_obsclk_register(struct device *dev, u32 oscdiv; int ret; - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return ERR_PTR(-ENOMEM); @@ -587,7 +587,7 @@ davinci_pll_obsclk_register(struct device *dev, mux->table = info->table; mux->mask = info->ocsrc_mask; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) { ret = -ENOMEM; goto err_free_mux; @@ -596,7 +596,7 @@ davinci_pll_obsclk_register(struct device *dev, gate->reg = base + CKEN; gate->bit_idx = CKEN_OBSCLK_SHIFT; - divider = kzalloc(sizeof(*divider), GFP_KERNEL); + divider = kzalloc_obj(*divider, GFP_KERNEL); if (!divider) { ret = -ENOMEM; goto err_free_gate; @@ -690,14 +690,14 @@ davinci_pll_sysclk_register(struct device *dev, else reg = PLLDIV4 + 4 * (info->id - 4); - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); gate->reg = base + reg; gate->bit_idx = DIV_ENABLE_SHIFT; - divider = kzalloc(sizeof(*divider), GFP_KERNEL); + divider = kzalloc_obj(*divider, GFP_KERNEL); if (!divider) { ret = -ENOMEM; goto err_free_gate; @@ -776,13 +776,13 @@ int of_davinci_pll_init(struct device *dev, struct device_node *node, int n_clks = max_sysclk_id + 1; int i; - clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); + clk_data = kzalloc_obj(*clk_data, GFP_KERNEL); if (!clk_data) { of_node_put(child); return -ENOMEM; } - clks = kmalloc_array(n_clks, sizeof(*clks), GFP_KERNEL); + clks = kmalloc_objs(*clks, n_clks, GFP_KERNEL); if (!clks) { kfree(clk_data); of_node_put(child); @@ -942,7 +942,7 @@ static void davinci_pll_debug_init(struct clk_hw *hw, struct dentry *dentry) struct davinci_pll_clk *pll = to_davinci_pll_clk(hw); struct debugfs_regset32 *regset; - regset = kzalloc(sizeof(*regset), GFP_KERNEL); + regset = kzalloc_obj(*regset, GFP_KERNEL); if (!regset) return; diff --git a/drivers/clk/davinci/psc.c b/drivers/clk/davinci/psc.c index f3ee9397bb0c..5a593f20ce81 100644 --- a/drivers/clk/davinci/psc.c +++ b/drivers/clk/davinci/psc.c @@ -239,7 +239,7 @@ davinci_lpsc_clk_register(struct device *dev, const char *name, int ret; bool is_on; - lpsc = kzalloc(sizeof(*lpsc), GFP_KERNEL); + lpsc = kzalloc_obj(*lpsc, GFP_KERNEL); if (!lpsc) return ERR_PTR(-ENOMEM); @@ -372,11 +372,11 @@ __davinci_psc_register_clocks(struct device *dev, struct regmap *regmap; int i, ret; - psc = kzalloc(sizeof(*psc), GFP_KERNEL); + psc = kzalloc_obj(*psc, GFP_KERNEL); if (!psc) return ERR_PTR(-ENOMEM); - clks = kmalloc_array(num_clks, sizeof(*clks), GFP_KERNEL); + clks = kmalloc_objs(*clks, num_clks, GFP_KERNEL); if (!clks) { ret = -ENOMEM; goto err_free_psc; @@ -392,7 +392,7 @@ __davinci_psc_register_clocks(struct device *dev, for (i = 0; i < num_clks; i++) clks[i] = ERR_PTR(-ENOENT); - pm_domains = kcalloc(num_clks, sizeof(*pm_domains), GFP_KERNEL); + pm_domains = kzalloc_objs(*pm_domains, num_clks, GFP_KERNEL); if (!pm_domains) { ret = -ENOMEM; goto err_free_clks; diff --git a/drivers/clk/hisilicon/clk-hi3620.c b/drivers/clk/hisilicon/clk-hi3620.c index 5d0226530fdb..069ea7b56c09 100644 --- a/drivers/clk/hisilicon/clk-hi3620.c +++ b/drivers/clk/hisilicon/clk-hi3620.c @@ -414,7 +414,7 @@ static struct clk *hisi_register_clk_mmc(struct hisi_mmc_clock *mmc_clk, struct clk *clk; struct clk_init_data init; - mclk = kzalloc(sizeof(*mclk), GFP_KERNEL); + mclk = kzalloc_obj(*mclk, GFP_KERNEL); if (!mclk) return ERR_PTR(-ENOMEM); @@ -461,11 +461,11 @@ static void __init hi3620_mmc_clk_init(struct device_node *node) return; } - clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); + clk_data = kzalloc_obj(*clk_data, GFP_KERNEL); if (WARN_ON(!clk_data)) return; - clk_data->clks = kcalloc(num, sizeof(*clk_data->clks), GFP_KERNEL); + clk_data->clks = kzalloc_objs(*clk_data->clks, num, GFP_KERNEL); if (!clk_data->clks) { kfree(clk_data); return; diff --git a/drivers/clk/hisilicon/clk-hix5hd2.c b/drivers/clk/hisilicon/clk-hix5hd2.c index 64bdd3f05725..31a9ab1758f1 100644 --- a/drivers/clk/hisilicon/clk-hix5hd2.c +++ b/drivers/clk/hisilicon/clk-hix5hd2.c @@ -261,7 +261,7 @@ hix5hd2_clk_register_complex(struct hix5hd2_complex_clock *clks, int nums, struct clk *clk; struct clk_init_data init; - p_clk = kzalloc(sizeof(*p_clk), GFP_KERNEL); + p_clk = kzalloc_obj(*p_clk, GFP_KERNEL); if (!p_clk) return; diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c index 09368fd32bef..8b37a6310289 100644 --- a/drivers/clk/hisilicon/clk.c +++ b/drivers/clk/hisilicon/clk.c @@ -68,12 +68,12 @@ struct hisi_clock_data *hisi_clk_init(struct device_node *np, goto err; } - clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); + clk_data = kzalloc_obj(*clk_data, GFP_KERNEL); if (!clk_data) goto err; clk_data->base = base; - clk_table = kcalloc(nr_clks, sizeof(*clk_table), GFP_KERNEL); + clk_table = kzalloc_objs(*clk_table, nr_clks, GFP_KERNEL); if (!clk_table) goto err_data; diff --git a/drivers/clk/hisilicon/clkdivider-hi6220.c b/drivers/clk/hisilicon/clkdivider-hi6220.c index fd7ceb92d651..c59c2c38812b 100644 --- a/drivers/clk/hisilicon/clkdivider-hi6220.c +++ b/drivers/clk/hisilicon/clkdivider-hi6220.c @@ -109,7 +109,7 @@ struct clk *hi6220_register_clkdiv(struct device *dev, const char *name, int i; /* allocate the divider */ - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return ERR_PTR(-ENOMEM); @@ -117,7 +117,7 @@ struct clk *hi6220_register_clkdiv(struct device *dev, const char *name, max_div = div_mask(width) + 1; min_div = 1; - table = kcalloc(max_div + 1, sizeof(*table), GFP_KERNEL); + table = kzalloc_objs(*table, max_div + 1, GFP_KERNEL); if (!table) { kfree(div); return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/hisilicon/clkgate-separated.c b/drivers/clk/hisilicon/clkgate-separated.c index 21d4297f3225..cb4fd20f7639 100644 --- a/drivers/clk/hisilicon/clkgate-separated.c +++ b/drivers/clk/hisilicon/clkgate-separated.c @@ -90,7 +90,7 @@ struct clk *hisi_register_clkgate_sep(struct device *dev, const char *name, struct clk *clk; struct clk_init_data init; - sclk = kzalloc(sizeof(*sclk), GFP_KERNEL); + sclk = kzalloc_obj(*sclk, GFP_KERNEL); if (!sclk) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/imgtec/clk-boston.c b/drivers/clk/imgtec/clk-boston.c index db96f8bea630..23360ba5c852 100644 --- a/drivers/clk/imgtec/clk-boston.c +++ b/drivers/clk/imgtec/clk-boston.c @@ -58,8 +58,7 @@ static void __init clk_boston_setup(struct device_node *np) cpu_div = ext_field(mmcmdiv, BOSTON_PLAT_MMCMDIV_CLK1DIV); cpu_freq = mult_frac(in_freq, mul, cpu_div); - onecell = kzalloc(struct_size(onecell, hws, BOSTON_CLK_COUNT), - GFP_KERNEL); + onecell = kzalloc_flex(*onecell, hws, BOSTON_CLK_COUNT, GFP_KERNEL); if (!onecell) return; 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; diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c index 91e7ac0cc334..69055ef880eb 100644 --- a/drivers/clk/ingenic/cgu.c +++ b/drivers/clk/ingenic/cgu.c @@ -676,7 +676,7 @@ static int ingenic_register_clock(struct ingenic_cgu *cgu, unsigned idx) goto out; } - ingenic_clk = kzalloc(sizeof(*ingenic_clk), GFP_KERNEL); + ingenic_clk = kzalloc_obj(*ingenic_clk, GFP_KERNEL); if (!ingenic_clk) { err = -ENOMEM; goto out; @@ -790,7 +790,7 @@ ingenic_cgu_new(const struct ingenic_cgu_clk_info *clock_info, { struct ingenic_cgu *cgu; - cgu = kzalloc(sizeof(*cgu), GFP_KERNEL); + cgu = kzalloc_obj(*cgu, GFP_KERNEL); if (!cgu) goto err_out; @@ -819,8 +819,8 @@ int ingenic_cgu_register_clocks(struct ingenic_cgu *cgu) unsigned i; int err; - cgu->clocks.clks = kcalloc(cgu->clocks.clk_num, sizeof(struct clk *), - GFP_KERNEL); + cgu->clocks.clks = kzalloc_objs(struct clk *, cgu->clocks.clk_num, + GFP_KERNEL); if (!cgu->clocks.clks) { err = -ENOMEM; goto err_out; diff --git a/drivers/clk/ingenic/tcu.c b/drivers/clk/ingenic/tcu.c index bc6a51da2072..6ae7c2f66824 100644 --- a/drivers/clk/ingenic/tcu.c +++ b/drivers/clk/ingenic/tcu.c @@ -273,7 +273,7 @@ static int __init ingenic_tcu_register_clock(struct ingenic_tcu *tcu, struct ingenic_tcu_clk *tcu_clk; int err; - tcu_clk = kzalloc(sizeof(*tcu_clk), GFP_KERNEL); + tcu_clk = kzalloc_obj(*tcu_clk, GFP_KERNEL); if (!tcu_clk) return -ENOMEM; @@ -344,7 +344,7 @@ static int __init ingenic_tcu_probe(struct device_node *np) if (IS_ERR(map)) return PTR_ERR(map); - tcu = kzalloc(sizeof(*tcu), GFP_KERNEL); + tcu = kzalloc_obj(*tcu, GFP_KERNEL); if (!tcu) return -ENOMEM; @@ -379,8 +379,7 @@ static int __init ingenic_tcu_probe(struct device_node *np) } } - tcu->clocks = kzalloc(struct_size(tcu->clocks, hws, TCU_CLK_COUNT), - GFP_KERNEL); + tcu->clocks = kzalloc_flex(*tcu->clocks, hws, TCU_CLK_COUNT, GFP_KERNEL); if (!tcu->clocks) { ret = -ENOMEM; goto err_clk_disable; diff --git a/drivers/clk/keystone/gate.c b/drivers/clk/keystone/gate.c index 13ea047489eb..dff8ed64df85 100644 --- a/drivers/clk/keystone/gate.c +++ b/drivers/clk/keystone/gate.c @@ -168,7 +168,7 @@ static struct clk *clk_register_psc(struct device *dev, struct clk_psc *psc; struct clk *clk; - psc = kzalloc(sizeof(*psc), GFP_KERNEL); + psc = kzalloc_obj(*psc, GFP_KERNEL); if (!psc) return ERR_PTR(-ENOMEM); @@ -202,7 +202,7 @@ static void __init of_psc_clk_init(struct device_node *node, spinlock_t *lock) struct clk *clk; int i; - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = kzalloc_obj(*data, GFP_KERNEL); if (!data) { pr_err("%s: Out of memory\n", __func__); return; diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c index 6bbdd4705d71..9cdf1ecad45c 100644 --- a/drivers/clk/keystone/pll.c +++ b/drivers/clk/keystone/pll.c @@ -126,7 +126,7 @@ static struct clk *clk_register_pll(struct device *dev, struct clk_pll *pll; struct clk *clk; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); @@ -162,7 +162,7 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl) struct clk *clk; int i; - pll_data = kzalloc(sizeof(*pll_data), GFP_KERNEL); + pll_data = kzalloc_obj(*pll_data, GFP_KERNEL); if (!pll_data) { pr_err("%s: Out of memory\n", __func__); return; diff --git a/drivers/clk/mediatek/clk-apmixed.c b/drivers/clk/mediatek/clk-apmixed.c index 60e34f124250..43c72621f4c9 100644 --- a/drivers/clk/mediatek/clk-apmixed.c +++ b/drivers/clk/mediatek/clk-apmixed.c @@ -77,7 +77,7 @@ struct clk_hw *mtk_clk_register_ref2usb_tx(const char *name, struct clk_init_data init = {}; int ret; - tx = kzalloc(sizeof(*tx), GFP_KERNEL); + tx = kzalloc_obj(*tx, GFP_KERNEL); if (!tx) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mediatek/clk-cpumux.c b/drivers/clk/mediatek/clk-cpumux.c index a03826db4dcb..abcc1c41a6f9 100644 --- a/drivers/clk/mediatek/clk-cpumux.c +++ b/drivers/clk/mediatek/clk-cpumux.c @@ -66,7 +66,7 @@ mtk_clk_register_cpumux(struct device *dev, const struct mtk_composite *mux, int ret; struct clk_init_data init; - cpumux = kzalloc(sizeof(*cpumux), GFP_KERNEL); + cpumux = kzalloc_obj(*cpumux, GFP_KERNEL); if (!cpumux) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mediatek/clk-gate.c b/drivers/clk/mediatek/clk-gate.c index f6b1429ff757..3689ec69da5d 100644 --- a/drivers/clk/mediatek/clk-gate.c +++ b/drivers/clk/mediatek/clk-gate.c @@ -212,7 +212,7 @@ static struct clk_hw *mtk_clk_register_gate(struct device *dev, int ret; struct clk_init_data init = {}; - cg = kzalloc(sizeof(*cg), GFP_KERNEL); + cg = kzalloc_obj(*cg, GFP_KERNEL); if (!cg) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index deafe55a96cb..de093f9665af 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -67,7 +67,7 @@ struct clk_hw_onecell_data *mtk_alloc_clk_data(unsigned int clk_num) { struct clk_hw_onecell_data *clk_data; - clk_data = kzalloc(struct_size(clk_data, hws, clk_num), GFP_KERNEL); + clk_data = kzalloc_flex(*clk_data, hws, clk_num, GFP_KERNEL); if (!clk_data) return NULL; @@ -230,7 +230,7 @@ static struct clk_hw *mtk_clk_register_composite(struct device *dev, int ret; if (mc->mux_shift >= 0) { - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return ERR_PTR(-ENOMEM); @@ -251,7 +251,7 @@ static struct clk_hw *mtk_clk_register_composite(struct device *dev, } if (mc->gate_shift >= 0) { - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) { ret = -ENOMEM; goto err_out; @@ -267,7 +267,7 @@ static struct clk_hw *mtk_clk_register_composite(struct device *dev, } if (mc->divider_shift >= 0) { - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) { ret = -ENOMEM; goto err_out; diff --git a/drivers/clk/mediatek/clk-mux.c b/drivers/clk/mediatek/clk-mux.c index c5af6dc078a3..0cc6de7ab29b 100644 --- a/drivers/clk/mediatek/clk-mux.c +++ b/drivers/clk/mediatek/clk-mux.c @@ -281,7 +281,7 @@ static struct clk_hw *mtk_clk_register_mux(struct device *dev, struct clk_init_data init = {}; int ret; - clk_mux = kzalloc(sizeof(*clk_mux), GFP_KERNEL); + clk_mux = kzalloc_obj(*clk_mux, GFP_KERNEL); if (!clk_mux) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c index 0f3759fcd9d0..ff414d9b560a 100644 --- a/drivers/clk/mediatek/clk-pll.c +++ b/drivers/clk/mediatek/clk-pll.c @@ -385,7 +385,7 @@ struct clk_hw *mtk_clk_register_pll(struct device *dev, struct clk_hw *hw; const struct clk_ops *pll_ops = data->ops ? data->ops : &mtk_pll_ops; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mediatek/clk-pllfh.c b/drivers/clk/mediatek/clk-pllfh.c index 8ad11023d911..6b9f43ddd57f 100644 --- a/drivers/clk/mediatek/clk-pllfh.c +++ b/drivers/clk/mediatek/clk-pllfh.c @@ -157,7 +157,7 @@ mtk_clk_register_pllfh(struct device *dev, const struct mtk_pll_data *pll_data, struct mtk_fh *fh; int ret; - fh = kzalloc(sizeof(*fh), GFP_KERNEL); + fh = kzalloc_obj(*fh, GFP_KERNEL); if (!fh) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index 95d0b9cbd904..d56be70ab02f 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -3646,7 +3646,7 @@ static void __init meson8b_clkc_init_common(struct device_node *np, return; } - rstc = kzalloc(sizeof(*rstc), GFP_KERNEL); + rstc = kzalloc_obj(*rstc, GFP_KERNEL); if (!rstc) return; diff --git a/drivers/clk/mmp/clk-apbc.c b/drivers/clk/mmp/clk-apbc.c index 23c43a46604e..1d6fd5e5d6c0 100644 --- a/drivers/clk/mmp/clk-apbc.c +++ b/drivers/clk/mmp/clk-apbc.c @@ -124,7 +124,7 @@ struct clk *mmp_clk_register_apbc(const char *name, const char *parent_name, struct clk *clk; struct clk_init_data init; - apbc = kzalloc(sizeof(*apbc), GFP_KERNEL); + apbc = kzalloc_obj(*apbc, GFP_KERNEL); if (!apbc) return NULL; diff --git a/drivers/clk/mmp/clk-apmu.c b/drivers/clk/mmp/clk-apmu.c index 9313428b083a..e457436c522c 100644 --- a/drivers/clk/mmp/clk-apmu.c +++ b/drivers/clk/mmp/clk-apmu.c @@ -69,7 +69,7 @@ struct clk *mmp_clk_register_apmu(const char *name, const char *parent_name, struct clk *clk; struct clk_init_data init; - apmu = kzalloc(sizeof(*apmu), GFP_KERNEL); + apmu = kzalloc_obj(*apmu, GFP_KERNEL); if (!apmu) return NULL; diff --git a/drivers/clk/mmp/clk-frac.c b/drivers/clk/mmp/clk-frac.c index 0b1bb01346f0..4307698741c6 100644 --- a/drivers/clk/mmp/clk-frac.c +++ b/drivers/clk/mmp/clk-frac.c @@ -180,7 +180,7 @@ struct clk *mmp_clk_register_factor(const char *name, const char *parent_name, return ERR_PTR(-EINVAL); } - factor = kzalloc(sizeof(*factor), GFP_KERNEL); + factor = kzalloc_obj(*factor, GFP_KERNEL); if (!factor) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mmp/clk-gate.c b/drivers/clk/mmp/clk-gate.c index 6855815ee8be..59f4070be33c 100644 --- a/drivers/clk/mmp/clk-gate.c +++ b/drivers/clk/mmp/clk-gate.c @@ -99,7 +99,7 @@ struct clk *mmp_clk_register_gate(struct device *dev, const char *name, struct clk_init_data init; /* allocate the gate */ - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mmp/clk-mix.c b/drivers/clk/mmp/clk-mix.c index 07ac9e6937e5..14aa90342664 100644 --- a/drivers/clk/mmp/clk-mix.c +++ b/drivers/clk/mmp/clk-mix.c @@ -448,7 +448,7 @@ struct clk *mmp_clk_register_mix(struct device *dev, struct clk *clk; struct clk_init_data init; - mix = kzalloc(sizeof(*mix), GFP_KERNEL); + mix = kzalloc_obj(*mix, GFP_KERNEL); if (!mix) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c index a4f15cee630e..2067b4bb261d 100644 --- a/drivers/clk/mmp/clk-of-mmp2.c +++ b/drivers/clk/mmp/clk-of-mmp2.c @@ -462,7 +462,7 @@ static void mmp2_clk_reset_init(struct device_node *np, int i, nr_resets; nr_resets = ARRAY_SIZE(apbc_gate_clks); - cells = kcalloc(nr_resets, sizeof(*cells), GFP_KERNEL); + cells = kzalloc_objs(*cells, nr_resets, GFP_KERNEL); if (!cells) return; @@ -516,7 +516,7 @@ static void __init mmp2_clk_init(struct device_node *np) { struct mmp2_clk_unit *pxa_unit; - pxa_unit = kzalloc(sizeof(*pxa_unit), GFP_KERNEL); + pxa_unit = kzalloc_obj(*pxa_unit, GFP_KERNEL); if (!pxa_unit) return; diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa168.c index 5f250427e60d..f5b8a6749829 100644 --- a/drivers/clk/mmp/clk-of-pxa168.c +++ b/drivers/clk/mmp/clk-of-pxa168.c @@ -282,7 +282,7 @@ static void pxa168_clk_reset_init(struct device_node *np, int i, nr_resets; nr_resets = ARRAY_SIZE(apbc_gate_clks); - cells = kcalloc(nr_resets, sizeof(*cells), GFP_KERNEL); + cells = kzalloc_objs(*cells, nr_resets, GFP_KERNEL); if (!cells) return; @@ -301,7 +301,7 @@ static void __init pxa168_clk_init(struct device_node *np) { struct pxa168_clk_unit *pxa_unit; - pxa_unit = kzalloc(sizeof(*pxa_unit), GFP_KERNEL); + pxa_unit = kzalloc_obj(*pxa_unit, GFP_KERNEL); if (!pxa_unit) return; diff --git a/drivers/clk/mmp/clk-of-pxa1928.c b/drivers/clk/mmp/clk-of-pxa1928.c index ebb6e278eda3..24fc9054a667 100644 --- a/drivers/clk/mmp/clk-of-pxa1928.c +++ b/drivers/clk/mmp/clk-of-pxa1928.c @@ -187,7 +187,7 @@ static void pxa1928_clk_reset_init(struct device_node *np, int i, base, nr_resets; nr_resets = ARRAY_SIZE(apbc_gate_clks); - cells = kcalloc(nr_resets, sizeof(*cells), GFP_KERNEL); + cells = kzalloc_objs(*cells, nr_resets, GFP_KERNEL); if (!cells) return; @@ -208,7 +208,7 @@ static void __init pxa1928_mpmu_clk_init(struct device_node *np) { struct pxa1928_clk_unit *pxa_unit; - pxa_unit = kzalloc(sizeof(*pxa_unit), GFP_KERNEL); + pxa_unit = kzalloc_obj(*pxa_unit, GFP_KERNEL); if (!pxa_unit) return; @@ -227,7 +227,7 @@ static void __init pxa1928_apmu_clk_init(struct device_node *np) { struct pxa1928_clk_unit *pxa_unit; - pxa_unit = kzalloc(sizeof(*pxa_unit), GFP_KERNEL); + pxa_unit = kzalloc_obj(*pxa_unit, GFP_KERNEL); if (!pxa_unit) return; @@ -248,7 +248,7 @@ static void __init pxa1928_apbc_clk_init(struct device_node *np) { struct pxa1928_clk_unit *pxa_unit; - pxa_unit = kzalloc(sizeof(*pxa_unit), GFP_KERNEL); + pxa_unit = kzalloc_obj(*pxa_unit, GFP_KERNEL); if (!pxa_unit) return; diff --git a/drivers/clk/mmp/clk-of-pxa910.c b/drivers/clk/mmp/clk-of-pxa910.c index fe65e7bdb411..43c40b949326 100644 --- a/drivers/clk/mmp/clk-of-pxa910.c +++ b/drivers/clk/mmp/clk-of-pxa910.c @@ -239,7 +239,7 @@ static void pxa910_clk_reset_init(struct device_node *np, nr_resets_apbc = ARRAY_SIZE(apbc_gate_clks); nr_resets_apbcp = ARRAY_SIZE(apbcp_gate_clks); nr_resets = nr_resets_apbc + nr_resets_apbcp; - cells = kcalloc(nr_resets, sizeof(*cells), GFP_KERNEL); + cells = kzalloc_objs(*cells, nr_resets, GFP_KERNEL); if (!cells) return; @@ -270,7 +270,7 @@ static void __init pxa910_clk_init(struct device_node *np) { struct pxa910_clk_unit *pxa_unit; - pxa_unit = kzalloc(sizeof(*pxa_unit), GFP_KERNEL); + pxa_unit = kzalloc_obj(*pxa_unit, GFP_KERNEL); if (!pxa_unit) return; diff --git a/drivers/clk/mmp/clk-pll.c b/drivers/clk/mmp/clk-pll.c index 962014cfdc44..bf2d691fcc92 100644 --- a/drivers/clk/mmp/clk-pll.c +++ b/drivers/clk/mmp/clk-pll.c @@ -108,7 +108,7 @@ static struct clk *mmp_clk_register_pll(char *name, struct clk *clk; struct clk_init_data init; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mmp/clk.c b/drivers/clk/mmp/clk.c index ca7d37e2c7be..c31c3a9f4f57 100644 --- a/drivers/clk/mmp/clk.c +++ b/drivers/clk/mmp/clk.c @@ -12,7 +12,7 @@ void mmp_clk_init(struct device_node *np, struct mmp_clk_unit *unit, { struct clk **clk_table; - clk_table = kcalloc(nr_clks, sizeof(struct clk *), GFP_KERNEL); + clk_table = kzalloc_objs(struct clk *, nr_clks, GFP_KERNEL); if (!clk_table) return; diff --git a/drivers/clk/mmp/pwr-island.c b/drivers/clk/mmp/pwr-island.c index eaf5d2c5e593..1253e383aa44 100644 --- a/drivers/clk/mmp/pwr-island.c +++ b/drivers/clk/mmp/pwr-island.c @@ -95,7 +95,7 @@ struct generic_pm_domain *mmp_pm_domain_register(const char *name, { struct mmp_pm_domain *pm_domain; - pm_domain = kzalloc(sizeof(*pm_domain), GFP_KERNEL); + pm_domain = kzalloc_obj(*pm_domain, GFP_KERNEL); if (!pm_domain) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mmp/reset.c b/drivers/clk/mmp/reset.c index ded7e391c737..c7068976a378 100644 --- a/drivers/clk/mmp/reset.c +++ b/drivers/clk/mmp/reset.c @@ -85,7 +85,7 @@ void mmp_clk_reset_register(struct device_node *np, { struct mmp_clk_reset_unit *unit; - unit = kzalloc(sizeof(*unit), GFP_KERNEL); + unit = kzalloc_obj(*unit, GFP_KERNEL); if (!unit) return; diff --git a/drivers/clk/mvebu/clk-corediv.c b/drivers/clk/mvebu/clk-corediv.c index 628032341cbb..487542d61662 100644 --- a/drivers/clk/mvebu/clk-corediv.c +++ b/drivers/clk/mvebu/clk-corediv.c @@ -270,13 +270,11 @@ mvebu_corediv_clk_init(struct device_node *node, clk_data.clk_num = soc_desc->ndescs; /* clks holds the clock array */ - clks = kcalloc(clk_data.clk_num, sizeof(struct clk *), - GFP_KERNEL); + clks = kzalloc_objs(struct clk *, clk_data.clk_num, GFP_KERNEL); if (WARN_ON(!clks)) goto err_unmap; /* corediv holds the clock specific array */ - corediv = kcalloc(clk_data.clk_num, sizeof(struct clk_corediv), - GFP_KERNEL); + corediv = kzalloc_objs(struct clk_corediv, clk_data.clk_num, GFP_KERNEL); if (WARN_ON(!corediv)) goto err_free_clks; diff --git a/drivers/clk/mvebu/clk-cpu.c b/drivers/clk/mvebu/clk-cpu.c index 0de7660e73d2..8c74edbcce9a 100644 --- a/drivers/clk/mvebu/clk-cpu.c +++ b/drivers/clk/mvebu/clk-cpu.c @@ -183,11 +183,11 @@ static void __init of_cpu_clk_setup(struct device_node *node) pr_warn("%s: pmu-dfs base register not set, dynamic frequency scaling not available\n", __func__); - cpuclk = kcalloc(ncpus, sizeof(*cpuclk), GFP_KERNEL); + cpuclk = kzalloc_objs(*cpuclk, ncpus, GFP_KERNEL); if (WARN_ON(!cpuclk)) goto cpuclk_out; - clks = kcalloc(ncpus, sizeof(*clks), GFP_KERNEL); + clks = kzalloc_objs(*clks, ncpus, GFP_KERNEL); if (WARN_ON(!clks)) goto clks_out; diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c index 5adbbd91a6db..41c5cd7739b2 100644 --- a/drivers/clk/mvebu/common.c +++ b/drivers/clk/mvebu/common.c @@ -124,8 +124,8 @@ void __init mvebu_coreclk_setup(struct device_node *np, if (desc->get_refclk_freq) clk_data.clk_num += 1; - clk_data.clks = kcalloc(clk_data.clk_num, sizeof(*clk_data.clks), - GFP_KERNEL); + clk_data.clks = kzalloc_objs(*clk_data.clks, clk_data.clk_num, + GFP_KERNEL); if (WARN_ON(!clk_data.clks)) { iounmap(base); return; @@ -258,7 +258,7 @@ void __init mvebu_clk_gating_setup(struct device_node *np, clk_put(clk); } - ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); + ctrl = kzalloc_obj(*ctrl, GFP_KERNEL); if (WARN_ON(!ctrl)) goto ctrl_out; @@ -272,8 +272,7 @@ void __init mvebu_clk_gating_setup(struct device_node *np, n++; ctrl->num_gates = n; - ctrl->gates = kcalloc(ctrl->num_gates, sizeof(*ctrl->gates), - GFP_KERNEL); + ctrl->gates = kzalloc_objs(*ctrl->gates, ctrl->num_gates, GFP_KERNEL); if (WARN_ON(!ctrl->gates)) goto gates_out; diff --git a/drivers/clk/mvebu/cp110-system-controller.c b/drivers/clk/mvebu/cp110-system-controller.c index b47c86906046..c6b5b2205f2e 100644 --- a/drivers/clk/mvebu/cp110-system-controller.c +++ b/drivers/clk/mvebu/cp110-system-controller.c @@ -180,7 +180,7 @@ static struct clk_hw *cp110_register_gate(const char *name, struct clk_init_data init; int ret; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mvebu/kirkwood.c b/drivers/clk/mvebu/kirkwood.c index 8bc893df4736..967f0be794ab 100644 --- a/drivers/clk/mvebu/kirkwood.c +++ b/drivers/clk/mvebu/kirkwood.c @@ -297,7 +297,7 @@ static void __init kirkwood_clk_muxing_setup(struct device_node *np, if (WARN_ON(!base)) return; - ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); + ctrl = kzalloc_obj(*ctrl, GFP_KERNEL); if (WARN_ON(!ctrl)) goto ctrl_out; @@ -309,8 +309,7 @@ static void __init kirkwood_clk_muxing_setup(struct device_node *np, n++; ctrl->num_muxes = n; - ctrl->muxes = kcalloc(ctrl->num_muxes, sizeof(struct clk *), - GFP_KERNEL); + ctrl->muxes = kzalloc_objs(struct clk *, ctrl->num_muxes, GFP_KERNEL); if (WARN_ON(!ctrl->muxes)) goto muxes_out; diff --git a/drivers/clk/mxs/clk-div.c b/drivers/clk/mxs/clk-div.c index 8afe1a9c1552..47c5c2fe8e5e 100644 --- a/drivers/clk/mxs/clk-div.c +++ b/drivers/clk/mxs/clk-div.c @@ -74,7 +74,7 @@ struct clk *mxs_clk_div(const char *name, const char *parent_name, struct clk *clk; struct clk_init_data init; - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mxs/clk-frac.c b/drivers/clk/mxs/clk-frac.c index 73f514fb84ff..7de0c20baabb 100644 --- a/drivers/clk/mxs/clk-frac.c +++ b/drivers/clk/mxs/clk-frac.c @@ -116,7 +116,7 @@ struct clk *mxs_clk_frac(const char *name, const char *parent_name, struct clk *clk; struct clk_init_data init; - frac = kzalloc(sizeof(*frac), GFP_KERNEL); + frac = kzalloc_obj(*frac, GFP_KERNEL); if (!frac) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mxs/clk-pll.c b/drivers/clk/mxs/clk-pll.c index 431cf6f2c936..f67bfe743479 100644 --- a/drivers/clk/mxs/clk-pll.c +++ b/drivers/clk/mxs/clk-pll.c @@ -86,7 +86,7 @@ struct clk *mxs_clk_pll(const char *name, const char *parent_name, struct clk *clk; struct clk_init_data init; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/mxs/clk-ref.c b/drivers/clk/mxs/clk-ref.c index a99ee4cd2ece..e6674fb58add 100644 --- a/drivers/clk/mxs/clk-ref.c +++ b/drivers/clk/mxs/clk-ref.c @@ -117,7 +117,7 @@ struct clk *mxs_clk_ref(const char *name, const char *parent_name, struct clk *clk; struct clk_init_data init; - ref = kzalloc(sizeof(*ref), GFP_KERNEL); + ref = kzalloc_obj(*ref, GFP_KERNEL); if (!ref) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/nxp/clk-lpc18xx-ccu.c b/drivers/clk/nxp/clk-lpc18xx-ccu.c index 751b786d73f8..8bb5a44c9b59 100644 --- a/drivers/clk/nxp/clk-lpc18xx-ccu.c +++ b/drivers/clk/nxp/clk-lpc18xx-ccu.c @@ -208,7 +208,7 @@ static void lpc18xx_ccu_register_branch_gate_div(struct lpc18xx_clk_branch *bran struct clk_hw *div_hw = NULL; if (branch->flags & CCU_BRANCH_HAVE_DIV2) { - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return; @@ -274,7 +274,7 @@ static void __init lpc18xx_ccu_init(struct device_node *np) return; } - clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); + clk_data = kzalloc_obj(*clk_data, GFP_KERNEL); if (!clk_data) { iounmap(reg_base); return; diff --git a/drivers/clk/pistachio/clk-pll.c b/drivers/clk/pistachio/clk-pll.c index d05337915e2b..dd4fe9a114a7 100644 --- a/drivers/clk/pistachio/clk-pll.c +++ b/drivers/clk/pistachio/clk-pll.c @@ -457,7 +457,7 @@ static struct clk *pll_register(const char *name, const char *parent_name, struct clk_init_data init; struct clk *clk; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/pistachio/clk.c b/drivers/clk/pistachio/clk.c index 23d076a2b133..80f60f2ce7de 100644 --- a/drivers/clk/pistachio/clk.c +++ b/drivers/clk/pistachio/clk.c @@ -17,11 +17,11 @@ pistachio_clk_alloc_provider(struct device_node *node, unsigned int num_clks) { struct pistachio_clk_provider *p; - p = kzalloc(sizeof(*p), GFP_KERNEL); + p = kzalloc_obj(*p, GFP_KERNEL); if (!p) return p; - p->clk_data.clks = kcalloc(num_clks, sizeof(struct clk *), GFP_KERNEL); + p->clk_data.clks = kzalloc_objs(struct clk *, num_clks, GFP_KERNEL); if (!p->clk_data.clks) goto free_provider; p->clk_data.clk_num = num_clks; diff --git a/drivers/clk/pxa/clk-pxa.c b/drivers/clk/pxa/clk-pxa.c index ebee2afd05de..1c5dedaefec8 100644 --- a/drivers/clk/pxa/clk-pxa.c +++ b/drivers/clk/pxa/clk-pxa.c @@ -104,7 +104,7 @@ int __init clk_pxa_cken_init(const struct desc_clk_cken *clks, struct clk *clk; for (i = 0; i < nb_clks; i++) { - pxa_clk = kzalloc(sizeof(*pxa_clk), GFP_KERNEL); + pxa_clk = kzalloc_obj(*pxa_clk, GFP_KERNEL); if (!pxa_clk) return -ENOMEM; pxa_clk->is_in_low_power = clks[i].is_in_low_power; diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index d0a5847f9111..0977b61f242e 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -1650,7 +1650,7 @@ static int clk_rcg2_dfs_populate_freq_table(struct clk_rcg2 *rcg) int i; /* Allocate space for 1 extra since table is NULL terminated */ - freq_tbl = kcalloc(MAX_PERF_LEVEL + 1, sizeof(*freq_tbl), GFP_KERNEL); + freq_tbl = kzalloc_objs(*freq_tbl, MAX_PERF_LEVEL + 1, GFP_KERNEL); if (!freq_tbl) return -ENOMEM; rcg->freq_tbl = freq_tbl; diff --git a/drivers/clk/ralink/clk-mt7621.c b/drivers/clk/ralink/clk-mt7621.c index 92d14350c4b3..3079d7ce0e57 100644 --- a/drivers/clk/ralink/clk-mt7621.c +++ b/drivers/clk/ralink/clk-mt7621.c @@ -354,7 +354,7 @@ static void __init mt7621_clk_init(struct device_node *node) struct clk_hw_onecell_data *clk_data; int ret, i, count; - priv = kzalloc(sizeof(*priv), GFP_KERNEL); + priv = kzalloc_obj(*priv, GFP_KERNEL); if (!priv) return; @@ -372,7 +372,7 @@ static void __init mt7621_clk_init(struct device_node *node) count = ARRAY_SIZE(mt7621_clks_base) + ARRAY_SIZE(mt7621_fixed_clks) + ARRAY_SIZE(mt7621_gates); - clk_data = kzalloc(struct_size(clk_data, hws, count), GFP_KERNEL); + clk_data = kzalloc_flex(*clk_data, hws, count, GFP_KERNEL); if (!clk_data) goto free_clk_priv; diff --git a/drivers/clk/ralink/clk-mtmips.c b/drivers/clk/ralink/clk-mtmips.c index 19d433034884..c6ee73a8fa22 100644 --- a/drivers/clk/ralink/clk-mtmips.c +++ b/drivers/clk/ralink/clk-mtmips.c @@ -916,7 +916,7 @@ static void __init mtmips_clk_init(struct device_node *node) struct clk_hw_onecell_data *clk_data; int ret, i, count; - priv = kzalloc(sizeof(*priv), GFP_KERNEL); + priv = kzalloc_obj(*priv, GFP_KERNEL); if (!priv) return; @@ -936,7 +936,7 @@ static void __init mtmips_clk_init(struct device_node *node) priv->data = data; count = priv->data->num_clk_base + priv->data->num_clk_fixed + priv->data->num_clk_factor + priv->data->num_clk_periph; - clk_data = kzalloc(struct_size(clk_data, hws, count), GFP_KERNEL); + clk_data = kzalloc_flex(*clk_data, hws, count, GFP_KERNEL); if (!clk_data) goto free_clk_priv; diff --git a/drivers/clk/renesas/clk-div6.c b/drivers/clk/renesas/clk-div6.c index f7b827b5e9b2..051515695c52 100644 --- a/drivers/clk/renesas/clk-div6.c +++ b/drivers/clk/renesas/clk-div6.c @@ -251,7 +251,7 @@ struct clk * __init cpg_div6_register(const char *name, struct clk *clk; unsigned int i; - clock = kzalloc(struct_size(clock, parents, num_parents), GFP_KERNEL); + clock = kzalloc_flex(*clock, parents, num_parents, GFP_KERNEL); if (!clock) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c index 2f65fe2c6bdf..79414c2c2e9c 100644 --- a/drivers/clk/renesas/clk-mstp.c +++ b/drivers/clk/renesas/clk-mstp.c @@ -150,7 +150,7 @@ static struct clk * __init cpg_mstp_clock_register(const char *name, struct mstp_clock *clock; struct clk *clk; - clock = kzalloc(sizeof(*clock), GFP_KERNEL); + clock = kzalloc_obj(*clock, GFP_KERNEL); if (!clock) return ERR_PTR(-ENOMEM); @@ -184,7 +184,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np) struct clk **clks; unsigned int i; - group = kzalloc(struct_size(group, clks, MSTP_MAX_CLOCKS), GFP_KERNEL); + group = kzalloc_flex(*group, clks, MSTP_MAX_CLOCKS, GFP_KERNEL); if (!group) return; @@ -316,7 +316,7 @@ void __init cpg_mstp_add_clk_domain(struct device_node *np) return; } - pd = kzalloc(sizeof(*pd), GFP_KERNEL); + pd = kzalloc_obj(*pd, GFP_KERNEL); if (!pd) return; diff --git a/drivers/clk/renesas/clk-r8a73a4.c b/drivers/clk/renesas/clk-r8a73a4.c index f331d8bc9daf..708506671a78 100644 --- a/drivers/clk/renesas/clk-r8a73a4.c +++ b/drivers/clk/renesas/clk-r8a73a4.c @@ -196,8 +196,8 @@ static void __init r8a73a4_cpg_clocks_init(struct device_node *np) return; } - cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); - clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL); + cpg = kzalloc_obj(*cpg, GFP_KERNEL); + clks = kzalloc_objs(*clks, num_clks, GFP_KERNEL); if (cpg == NULL || clks == NULL) { /* We're leaking memory on purpose, there's no point in cleaning * up as the system won't boot anyway. diff --git a/drivers/clk/renesas/clk-r8a7740.c b/drivers/clk/renesas/clk-r8a7740.c index 22e9be7240bb..f4c4ef44cff9 100644 --- a/drivers/clk/renesas/clk-r8a7740.c +++ b/drivers/clk/renesas/clk-r8a7740.c @@ -155,8 +155,8 @@ static void __init r8a7740_cpg_clocks_init(struct device_node *np) return; } - cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); - clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL); + cpg = kzalloc_obj(*cpg, GFP_KERNEL); + clks = kzalloc_objs(*clks, num_clks, GFP_KERNEL); if (cpg == NULL || clks == NULL) { /* We're leaking memory on purpose, there's no point in cleaning * up as the system won't boot anyway. diff --git a/drivers/clk/renesas/clk-r8a7778.c b/drivers/clk/renesas/clk-r8a7778.c index 6ea173f22251..2f664c7efba5 100644 --- a/drivers/clk/renesas/clk-r8a7778.c +++ b/drivers/clk/renesas/clk-r8a7778.c @@ -92,8 +92,8 @@ static void __init r8a7778_cpg_clocks_init(struct device_node *np) return; } - data = kzalloc(sizeof(*data), GFP_KERNEL); - clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL); + data = kzalloc_obj(*data, GFP_KERNEL); + clks = kzalloc_objs(*clks, num_clks, GFP_KERNEL); if (data == NULL || clks == NULL) { /* We're leaking memory on purpose, there's no point in cleaning * up as the system won't boot anyway. diff --git a/drivers/clk/renesas/clk-r8a7779.c b/drivers/clk/renesas/clk-r8a7779.c index 9a2fea8cf4d7..9243848863f2 100644 --- a/drivers/clk/renesas/clk-r8a7779.c +++ b/drivers/clk/renesas/clk-r8a7779.c @@ -128,8 +128,8 @@ static void __init r8a7779_cpg_clocks_init(struct device_node *np) return; } - data = kzalloc(sizeof(*data), GFP_KERNEL); - clks = kcalloc(CPG_NUM_CLOCKS, sizeof(*clks), GFP_KERNEL); + data = kzalloc_obj(*data, GFP_KERNEL); + clks = kzalloc_objs(*clks, CPG_NUM_CLOCKS, GFP_KERNEL); if (data == NULL || clks == NULL) { /* We're leaking memory on purpose, there's no point in cleaning * up as the system won't boot anyway. diff --git a/drivers/clk/renesas/clk-rz.c b/drivers/clk/renesas/clk-rz.c index e770f09a27ed..0a89be1fce79 100644 --- a/drivers/clk/renesas/clk-rz.c +++ b/drivers/clk/renesas/clk-rz.c @@ -91,8 +91,8 @@ static void __init rz_cpg_clocks_init(struct device_node *np) if (WARN(num_clks <= 0, "can't count CPG clocks\n")) return; - data = kzalloc(sizeof(*data), GFP_KERNEL); - clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL); + data = kzalloc_obj(*data, GFP_KERNEL); + clks = kzalloc_objs(*clks, num_clks, GFP_KERNEL); BUG_ON(!data || !clks); data->clks = clks; diff --git a/drivers/clk/renesas/clk-sh73a0.c b/drivers/clk/renesas/clk-sh73a0.c index 47fc99ccd283..a3bbd8a0ac4d 100644 --- a/drivers/clk/renesas/clk-sh73a0.c +++ b/drivers/clk/renesas/clk-sh73a0.c @@ -170,8 +170,8 @@ static void __init sh73a0_cpg_clocks_init(struct device_node *np) return; } - cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); - clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL); + cpg = kzalloc_obj(*cpg, GFP_KERNEL); + clks = kzalloc_objs(*clks, num_clks, GFP_KERNEL); if (cpg == NULL || clks == NULL) { /* We're leaking memory on purpose, there's no point in cleaning * up as the system won't boot anyway. diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c index 0f5c91b5dfa9..58255bf6da83 100644 --- a/drivers/clk/renesas/r9a06g032-clocks.c +++ b/drivers/clk/renesas/r9a06g032-clocks.c @@ -891,7 +891,7 @@ r9a06g032_register_gate(struct r9a06g032_priv *clocks, struct r9a06g032_clk_gate *g; struct clk_init_data init = {}; - g = kzalloc(sizeof(*g), GFP_KERNEL); + g = kzalloc_obj(*g, GFP_KERNEL); if (!g) return NULL; @@ -1063,7 +1063,7 @@ r9a06g032_register_div(struct r9a06g032_priv *clocks, struct clk_init_data init = {}; unsigned int i; - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return NULL; @@ -1149,7 +1149,7 @@ r9a06g032_register_bitsel(struct r9a06g032_priv *clocks, const char *names[2]; /* allocate the gate */ - g = kzalloc(sizeof(*g), GFP_KERNEL); + g = kzalloc_obj(*g, GFP_KERNEL); if (!g) return NULL; @@ -1239,7 +1239,7 @@ r9a06g032_register_dualgate(struct r9a06g032_priv *clocks, struct clk_init_data init = {}; /* allocate the gate */ - g = kzalloc(sizeof(*g), GFP_KERNEL); + g = kzalloc_obj(*g, GFP_KERNEL); if (!g) return NULL; g->clocks = clocks; diff --git a/drivers/clk/renesas/rcar-cpg-lib.c b/drivers/clk/renesas/rcar-cpg-lib.c index 7b271de7037a..f4279af8787f 100644 --- a/drivers/clk/renesas/rcar-cpg-lib.c +++ b/drivers/clk/renesas/rcar-cpg-lib.c @@ -94,7 +94,7 @@ struct clk * __init cpg_sdh_clk_register(const char *name, struct cpg_simple_notifier *csn; struct clk *clk; - csn = kzalloc(sizeof(*csn), GFP_KERNEL); + csn = kzalloc_obj(*csn, GFP_KERNEL); if (!csn) return ERR_PTR(-ENOMEM); @@ -144,7 +144,7 @@ struct clk * __init cpg_rpc_clk_register(const char *name, struct rpc_clock *rpc; struct clk *clk; - rpc = kzalloc(sizeof(*rpc), GFP_KERNEL); + rpc = kzalloc_obj(*rpc, GFP_KERNEL); if (!rpc) return ERR_PTR(-ENOMEM); @@ -185,7 +185,7 @@ struct clk * __init cpg_rpcd2_clk_register(const char *name, struct rpcd2_clock *rpcd2; struct clk *clk; - rpcd2 = kzalloc(sizeof(*rpcd2), GFP_KERNEL); + rpcd2 = kzalloc_obj(*rpcd2, GFP_KERNEL); if (!rpcd2) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/renesas/rcar-gen2-cpg.c b/drivers/clk/renesas/rcar-gen2-cpg.c index ab34bb8c3e07..69618ec0b638 100644 --- a/drivers/clk/renesas/rcar-gen2-cpg.c +++ b/drivers/clk/renesas/rcar-gen2-cpg.c @@ -141,7 +141,7 @@ static struct clk * __init cpg_z_clk_register(const char *name, struct cpg_z_clk *zclk; struct clk *clk; - zclk = kzalloc(sizeof(*zclk), GFP_KERNEL); + zclk = kzalloc_obj(*zclk, GFP_KERNEL); if (!zclk) return ERR_PTR(-ENOMEM); @@ -169,14 +169,14 @@ static struct clk * __init cpg_rcan_clk_register(const char *name, struct clk_gate *gate; struct clk *clk; - fixed = kzalloc(sizeof(*fixed), GFP_KERNEL); + fixed = kzalloc_obj(*fixed, GFP_KERNEL); if (!fixed) return ERR_PTR(-ENOMEM); fixed->mult = 1; fixed->div = 6; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) { kfree(fixed); return ERR_PTR(-ENOMEM); @@ -213,7 +213,7 @@ static struct clk * __init cpg_adsp_clk_register(const char *name, struct clk_gate *gate; struct clk *clk; - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return ERR_PTR(-ENOMEM); @@ -222,7 +222,7 @@ static struct clk * __init cpg_adsp_clk_register(const char *name, div->table = cpg_adsp_div_table; div->lock = &cpg_lock; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) { kfree(div); return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/renesas/rcar-gen3-cpg.c b/drivers/clk/renesas/rcar-gen3-cpg.c index b954278ddd9d..605854200b04 100644 --- a/drivers/clk/renesas/rcar-gen3-cpg.c +++ b/drivers/clk/renesas/rcar-gen3-cpg.c @@ -123,7 +123,7 @@ static struct clk * __init cpg_pll_clk_register(const char *name, struct clk_init_data init = {}; struct clk *clk; - pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); + pll_clk = kzalloc_obj(*pll_clk, GFP_KERNEL); if (!pll_clk) return ERR_PTR(-ENOMEM); @@ -271,7 +271,7 @@ static struct clk * __init __cpg_z_clk_register(const char *name, struct cpg_z_clk *zclk; struct clk *clk; - zclk = kzalloc(sizeof(*zclk), GFP_KERNEL); + zclk = kzalloc_obj(*zclk, GFP_KERNEL); if (!zclk) return ERR_PTR(-ENOMEM); @@ -410,7 +410,7 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev, if (cpg_quirks & RCKCR_CKSEL) { struct cpg_simple_notifier *csn; - csn = kzalloc(sizeof(*csn), GFP_KERNEL); + csn = kzalloc_obj(*csn, GFP_KERNEL); if (!csn) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/renesas/rcar-gen4-cpg.c b/drivers/clk/renesas/rcar-gen4-cpg.c index ac2b5afec46d..7168939ddb65 100644 --- a/drivers/clk/renesas/rcar-gen4-cpg.c +++ b/drivers/clk/renesas/rcar-gen4-cpg.c @@ -234,7 +234,7 @@ static struct clk * __init cpg_pll_clk_register(const char *name, struct cpg_pll_clk *pll_clk; struct clk *clk; - pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); + pll_clk = kzalloc_obj(*pll_clk, GFP_KERNEL); if (!pll_clk) return ERR_PTR(-ENOMEM); @@ -374,7 +374,7 @@ static struct clk * __init cpg_z_clk_register(const char *name, struct cpg_z_clk *zclk; struct clk *clk; - zclk = kzalloc(sizeof(*zclk), GFP_KERNEL); + zclk = kzalloc_obj(*zclk, GFP_KERNEL); if (!zclk) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c index 4824607d56c0..48105ee90c83 100644 --- a/drivers/clk/renesas/renesas-cpg-mssr.c +++ b/drivers/clk/renesas/renesas-cpg-mssr.c @@ -512,7 +512,7 @@ static void __init cpg_mssr_register_mod_clk(const struct mssr_mod_clk *mod, goto fail; } - clock = kzalloc(sizeof(*clock), GFP_KERNEL); + clock = kzalloc_obj(*clock, GFP_KERNEL); if (!clock) { clk = ERR_PTR(-ENOMEM); goto fail; @@ -1258,7 +1258,7 @@ static int __init cpg_mssr_common_init(struct device *dev, } nclks = info->num_total_core_clks + info->num_hw_mod_clks; - priv = kzalloc(struct_size(priv, clks, nclks), GFP_KERNEL); + priv = kzalloc_flex(*priv, clks, nclks, GFP_KERNEL); if (!priv) return -ENOMEM; diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c index 6e91a3041a03..456b23e6be42 100644 --- a/drivers/clk/rockchip/clk-cpu.c +++ b/drivers/clk/rockchip/clk-cpu.c @@ -313,7 +313,7 @@ struct clk *rockchip_clk_register_cpuclk(const char *name, return ERR_PTR(-EINVAL); } - cpuclk = kzalloc(sizeof(*cpuclk), GFP_KERNEL); + cpuclk = kzalloc_obj(*cpuclk, GFP_KERNEL); if (!cpuclk) return ERR_PTR(-ENOMEM); @@ -479,7 +479,7 @@ struct clk *rockchip_clk_register_cpuclk_multi_pll(const char *name, int ret; if (num_parents > 1) { - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return ERR_PTR(-ENOMEM); @@ -493,7 +493,7 @@ struct clk *rockchip_clk_register_cpuclk_multi_pll(const char *name, } if (div_width > 0) { - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) { ret = -ENOMEM; goto free_mux; @@ -521,7 +521,7 @@ struct clk *rockchip_clk_register_cpuclk_multi_pll(const char *name, goto free_div; } - cpuclk = kzalloc(sizeof(*cpuclk), GFP_KERNEL); + cpuclk = kzalloc_obj(*cpuclk, GFP_KERNEL); if (!cpuclk) { ret = -ENOMEM; goto unregister_clk; diff --git a/drivers/clk/rockchip/clk-ddr.c b/drivers/clk/rockchip/clk-ddr.c index 8866a65982a0..96985682b98c 100644 --- a/drivers/clk/rockchip/clk-ddr.c +++ b/drivers/clk/rockchip/clk-ddr.c @@ -100,7 +100,7 @@ struct clk *rockchip_clk_register_ddrclk(const char *name, int flags, struct clk_init_data init; struct clk *clk; - ddrclk = kzalloc(sizeof(*ddrclk), GFP_KERNEL); + ddrclk = kzalloc_obj(*ddrclk, GFP_KERNEL); if (!ddrclk) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/rockchip/clk-gate-grf.c b/drivers/clk/rockchip/clk-gate-grf.c index 8122f471f391..b3df39f9b317 100644 --- a/drivers/clk/rockchip/clk-gate-grf.c +++ b/drivers/clk/rockchip/clk-gate-grf.c @@ -81,7 +81,7 @@ struct clk *rockchip_clk_register_gate_grf(const char *name, return ERR_PTR(-EOPNOTSUPP); } - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/rockchip/clk-half-divider.c b/drivers/clk/rockchip/clk-half-divider.c index fbc018e8afa4..ac77911fa058 100644 --- a/drivers/clk/rockchip/clk-half-divider.c +++ b/drivers/clk/rockchip/clk-half-divider.c @@ -176,7 +176,7 @@ struct clk *rockchip_clk_register_halfdiv(const char *name, *gate_ops = NULL; if (num_parents > 1) { - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return ERR_PTR(-ENOMEM); @@ -190,7 +190,7 @@ struct clk *rockchip_clk_register_halfdiv(const char *name, } if (gate_offset >= 0) { - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) goto err_gate; @@ -202,7 +202,7 @@ struct clk *rockchip_clk_register_halfdiv(const char *name, } if (div_width > 0) { - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) goto err_div; diff --git a/drivers/clk/rockchip/clk-inverter.c b/drivers/clk/rockchip/clk-inverter.c index 5dfbdce18b48..53c17047077c 100644 --- a/drivers/clk/rockchip/clk-inverter.c +++ b/drivers/clk/rockchip/clk-inverter.c @@ -79,7 +79,7 @@ struct clk *rockchip_clk_register_inverter(const char *name, struct rockchip_inv_clock *inv_clock; struct clk *clk; - inv_clock = kmalloc(sizeof(*inv_clock), GFP_KERNEL); + inv_clock = kmalloc_obj(*inv_clock, GFP_KERNEL); if (!inv_clock) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/rockchip/clk-mmc-phase.c b/drivers/clk/rockchip/clk-mmc-phase.c index 8b1292c56863..c8bb8a217eaa 100644 --- a/drivers/clk/rockchip/clk-mmc-phase.c +++ b/drivers/clk/rockchip/clk-mmc-phase.c @@ -210,7 +210,7 @@ struct clk *rockchip_clk_register_mmc(const char *name, struct clk *clk; int ret; - mmc_clock = kmalloc(sizeof(*mmc_clock), GFP_KERNEL); + mmc_clock = kmalloc_obj(*mmc_clock, GFP_KERNEL); if (!mmc_clock) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/rockchip/clk-muxgrf.c b/drivers/clk/rockchip/clk-muxgrf.c index 4a335a5f4633..7545df0adabe 100644 --- a/drivers/clk/rockchip/clk-muxgrf.c +++ b/drivers/clk/rockchip/clk-muxgrf.c @@ -67,7 +67,7 @@ struct clk *rockchip_clk_register_muxgrf(const char *name, return ERR_PTR(-ENOTSUPP); } - muxgrf_clock = kmalloc(sizeof(*muxgrf_clock), GFP_KERNEL); + muxgrf_clock = kmalloc_obj(*muxgrf_clock, GFP_KERNEL); if (!muxgrf_clock) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c index 86dba3826a77..865151d88b9f 100644 --- a/drivers/clk/rockchip/clk-pll.c +++ b/drivers/clk/rockchip/clk-pll.c @@ -1076,7 +1076,7 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx, /* name the actual pll */ snprintf(pll_name, sizeof(pll_name), "pll_%s", name); - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/rockchip/clk-rk3576.c b/drivers/clk/rockchip/clk-rk3576.c index 9bc0ef51ef68..59285a784cd0 100644 --- a/drivers/clk/rockchip/clk-rk3576.c +++ b/drivers/clk/rockchip/clk-rk3576.c @@ -1769,7 +1769,7 @@ static void __init rk3576_clk_init(struct device_node *np) goto err_unmap; } - pmu0_grf_e = kzalloc(sizeof(*pmu0_grf_e), GFP_KERNEL); + pmu0_grf_e = kzalloc_obj(*pmu0_grf_e, GFP_KERNEL); if (!pmu0_grf_e) goto err_unmap; @@ -1777,7 +1777,7 @@ static void __init rk3576_clk_init(struct device_node *np) pmu0_grf_e->type = grf_type_pmu0; hash_add(ctx->aux_grf_table, &pmu0_grf_e->node, grf_type_pmu0); - ioc_grf_e = kzalloc(sizeof(*ioc_grf_e), GFP_KERNEL); + ioc_grf_e = kzalloc_obj(*ioc_grf_e, GFP_KERNEL); if (!ioc_grf_e) goto err_free_pmu0; diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c index 9ac9d13e87de..ec9517d7c2b7 100644 --- a/drivers/clk/rockchip/clk.c +++ b/drivers/clk/rockchip/clk.c @@ -55,7 +55,7 @@ static struct clk *rockchip_clk_register_branch(const char *name, int ret; if (num_parents > 1) { - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return ERR_PTR(-ENOMEM); @@ -70,7 +70,7 @@ static struct clk *rockchip_clk_register_branch(const char *name, } if (gate_offset >= 0) { - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) { ret = -ENOMEM; goto err_gate; @@ -84,7 +84,7 @@ static struct clk *rockchip_clk_register_branch(const char *name, } if (div_width > 0) { - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) { ret = -ENOMEM; goto err_div; @@ -221,7 +221,7 @@ static struct clk *rockchip_clk_register_frac_branch( return ERR_PTR(-EINVAL); } - frac = kzalloc(sizeof(*frac), GFP_KERNEL); + frac = kzalloc_obj(*frac, GFP_KERNEL); if (!frac) return ERR_PTR(-ENOMEM); @@ -323,7 +323,7 @@ static struct clk *rockchip_clk_register_factor_branch(const char *name, div); } - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); @@ -332,7 +332,7 @@ static struct clk *rockchip_clk_register_factor_branch(const char *name, gate->bit_idx = gate_shift; gate->lock = lock; - fix = kzalloc(sizeof(*fix), GFP_KERNEL); + fix = kzalloc_obj(*fix, GFP_KERNEL); if (!fix) { kfree(gate); return ERR_PTR(-ENOMEM); @@ -365,11 +365,11 @@ static struct rockchip_clk_provider *rockchip_clk_init_base( default_clk_val = ERR_PTR(has_late_clocks ? -EPROBE_DEFER : -ENOENT); - ctx = kzalloc(sizeof(struct rockchip_clk_provider), GFP_KERNEL); + ctx = kzalloc_obj(struct rockchip_clk_provider, GFP_KERNEL); if (!ctx) return ERR_PTR(-ENOMEM); - clk_table = kcalloc(nr_clks, sizeof(struct clk *), GFP_KERNEL); + clk_table = kzalloc_objs(struct clk *, nr_clks, GFP_KERNEL); if (!clk_table) goto err_free; diff --git a/drivers/clk/rockchip/softrst.c b/drivers/clk/rockchip/softrst.c index fd56aaefe6d1..01caa91e7ce3 100644 --- a/drivers/clk/rockchip/softrst.c +++ b/drivers/clk/rockchip/softrst.c @@ -96,7 +96,7 @@ void rockchip_register_softrst_lut(struct device_node *np, struct rockchip_softrst *softrst; int ret; - softrst = kzalloc(sizeof(*softrst), GFP_KERNEL); + softrst = kzalloc_obj(*softrst, GFP_KERNEL); if (!softrst) return; diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index 300f8d5d3c48..d8729dceabb0 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -660,7 +660,7 @@ static int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, return -EINVAL; } - cpuclk = kzalloc(sizeof(*cpuclk), GFP_KERNEL); + cpuclk = kzalloc_obj(*cpuclk, GFP_KERNEL); if (!cpuclk) return -ENOMEM; diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c index 0a8fc9649ae2..1bd8def3973e 100644 --- a/drivers/clk/samsung/clk-pll.c +++ b/drivers/clk/samsung/clk-pll.c @@ -1435,7 +1435,7 @@ static void __init _samsung_clk_register_pll(struct samsung_clk_provider *ctx, struct clk_init_data init; int ret, len; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) { pr_err("%s: could not allocate pll clk %s\n", __func__, pll_clk->name); diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c index 9f68f079fd55..39580d82077b 100644 --- a/drivers/clk/samsung/clk.c +++ b/drivers/clk/samsung/clk.c @@ -55,7 +55,7 @@ struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump( struct samsung_clk_reg_dump *rd; unsigned int i; - rd = kcalloc(nr_rdump, sizeof(*rd), GFP_KERNEL); + rd = kzalloc_objs(*rd, nr_rdump, GFP_KERNEL); if (!rd) return NULL; @@ -82,7 +82,7 @@ struct samsung_clk_provider * __init samsung_clk_init(struct device *dev, struct samsung_clk_provider *ctx; int i; - ctx = kzalloc(struct_size(ctx, clk_data.hws, nr_clks), GFP_KERNEL); + ctx = kzalloc_flex(*ctx, clk_data.hws, nr_clks, GFP_KERNEL); if (!ctx) panic("could not allocate clock provider context.\n"); @@ -301,7 +301,7 @@ struct clk_hw *samsung_register_auto_gate(struct device *dev, int ret = -EINVAL; /* allocate the gate */ - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); @@ -431,8 +431,7 @@ void samsung_clk_extended_sleep_init(void __iomem *reg_base, { struct samsung_clock_reg_cache *reg_cache; - reg_cache = kzalloc(sizeof(struct samsung_clock_reg_cache), - GFP_KERNEL); + reg_cache = kzalloc_obj(struct samsung_clock_reg_cache, GFP_KERNEL); if (!reg_cache) panic("could not allocate register reg_cache.\n"); reg_cache->rdump = samsung_clk_alloc_reg_dump(rdump, nr_rdump); diff --git a/drivers/clk/socfpga/clk-gate-a10.c b/drivers/clk/socfpga/clk-gate-a10.c index 06f129c160bc..c6505046b63b 100644 --- a/drivers/clk/socfpga/clk-gate-a10.c +++ b/drivers/clk/socfpga/clk-gate-a10.c @@ -52,7 +52,7 @@ static void __init __socfpga_gate_init(struct device_node *node, struct clk_init_data init; int rc; - socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL); + socfpga_clk = kzalloc_obj(*socfpga_clk, GFP_KERNEL); if (WARN_ON(!socfpga_clk)) return; diff --git a/drivers/clk/socfpga/clk-gate-s10.c b/drivers/clk/socfpga/clk-gate-s10.c index dce3ef137bf3..913c31d94319 100644 --- a/drivers/clk/socfpga/clk-gate-s10.c +++ b/drivers/clk/socfpga/clk-gate-s10.c @@ -132,7 +132,7 @@ struct clk_hw *s10_register_gate(const struct stratix10_gate_clock *clks, void _ const char *parent_name = clks->parent_name; int ret; - socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL); + socfpga_clk = kzalloc_obj(*socfpga_clk, GFP_KERNEL); if (!socfpga_clk) return NULL; @@ -190,7 +190,7 @@ struct clk_hw *agilex_register_gate(const struct stratix10_gate_clock *clks, voi const char *parent_name = clks->parent_name; int ret; - socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL); + socfpga_clk = kzalloc_obj(*socfpga_clk, GFP_KERNEL); if (!socfpga_clk) return NULL; @@ -247,7 +247,7 @@ struct clk_hw *agilex5_register_gate(const struct agilex5_gate_clock *clks, void struct clk_init_data init; int ret; - socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL); + socfpga_clk = kzalloc_obj(*socfpga_clk, GFP_KERNEL); if (!socfpga_clk) return NULL; diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c index 0a5a95e0267f..52dd6e2f19f9 100644 --- a/drivers/clk/socfpga/clk-gate.c +++ b/drivers/clk/socfpga/clk-gate.c @@ -147,7 +147,7 @@ void __init socfpga_gate_init(struct device_node *node) struct clk_ops *ops; int rc; - socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL); + socfpga_clk = kzalloc_obj(*socfpga_clk, GFP_KERNEL); if (WARN_ON(!socfpga_clk)) return; diff --git a/drivers/clk/socfpga/clk-periph-a10.c b/drivers/clk/socfpga/clk-periph-a10.c index 64cc70b970b7..7f61ce1793b2 100644 --- a/drivers/clk/socfpga/clk-periph-a10.c +++ b/drivers/clk/socfpga/clk-periph-a10.c @@ -72,7 +72,7 @@ static void __init __socfpga_periph_init(struct device_node *node, of_property_read_u32(node, "reg", ®); - periph_clk = kzalloc(sizeof(*periph_clk), GFP_KERNEL); + periph_clk = kzalloc_obj(*periph_clk, GFP_KERNEL); if (WARN_ON(!periph_clk)) return; diff --git a/drivers/clk/socfpga/clk-periph-s10.c b/drivers/clk/socfpga/clk-periph-s10.c index f12ca43ffe7c..f43ffd4dfa82 100644 --- a/drivers/clk/socfpga/clk-periph-s10.c +++ b/drivers/clk/socfpga/clk-periph-s10.c @@ -108,7 +108,7 @@ struct clk_hw *s10_register_periph(const struct stratix10_perip_c_clock *clks, const char *parent_name = clks->parent_name; int ret; - periph_clk = kzalloc(sizeof(*periph_clk), GFP_KERNEL); + periph_clk = kzalloc_obj(*periph_clk, GFP_KERNEL); if (WARN_ON(!periph_clk)) return NULL; @@ -144,7 +144,7 @@ struct clk_hw *n5x_register_periph(const struct n5x_perip_c_clock *clks, const char *parent_name = clks->parent_name; int ret; - periph_clk = kzalloc(sizeof(*periph_clk), GFP_KERNEL); + periph_clk = kzalloc_obj(*periph_clk, GFP_KERNEL); if (WARN_ON(!periph_clk)) return NULL; @@ -179,7 +179,7 @@ struct clk_hw *s10_register_cnt_periph(const struct stratix10_perip_cnt_clock *c const char *parent_name = clks->parent_name; int ret; - periph_clk = kzalloc(sizeof(*periph_clk), GFP_KERNEL); + periph_clk = kzalloc_obj(*periph_clk, GFP_KERNEL); if (WARN_ON(!periph_clk)) return NULL; @@ -224,7 +224,7 @@ struct clk_hw *agilex5_register_cnt_periph(const struct agilex5_perip_cnt_clock const char *name = clks->name; int ret; - periph_clk = kzalloc(sizeof(*periph_clk), GFP_KERNEL); + periph_clk = kzalloc_obj(*periph_clk, GFP_KERNEL); if (WARN_ON(!periph_clk)) return NULL; diff --git a/drivers/clk/socfpga/clk-periph.c b/drivers/clk/socfpga/clk-periph.c index 6a4075147b9c..2719af1502c1 100644 --- a/drivers/clk/socfpga/clk-periph.c +++ b/drivers/clk/socfpga/clk-periph.c @@ -62,7 +62,7 @@ static void __init __socfpga_periph_init(struct device_node *node, of_property_read_u32(node, "reg", ®); - periph_clk = kzalloc(sizeof(*periph_clk), GFP_KERNEL); + periph_clk = kzalloc_obj(*periph_clk, GFP_KERNEL); if (WARN_ON(!periph_clk)) return; diff --git a/drivers/clk/socfpga/clk-pll-a10.c b/drivers/clk/socfpga/clk-pll-a10.c index 62eed964c3d0..633c30b70d25 100644 --- a/drivers/clk/socfpga/clk-pll-a10.c +++ b/drivers/clk/socfpga/clk-pll-a10.c @@ -78,7 +78,7 @@ static void __init __socfpga_pll_init(struct device_node *node, of_property_read_u32(node, "reg", ®); - pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); + pll_clk = kzalloc_obj(*pll_clk, GFP_KERNEL); if (WARN_ON(!pll_clk)) return; diff --git a/drivers/clk/socfpga/clk-pll-s10.c b/drivers/clk/socfpga/clk-pll-s10.c index 1be92827cd93..3c8302a7ec5b 100644 --- a/drivers/clk/socfpga/clk-pll-s10.c +++ b/drivers/clk/socfpga/clk-pll-s10.c @@ -196,7 +196,7 @@ struct clk_hw *s10_register_pll(const struct stratix10_pll_clock *clks, const char *name = clks->name; int ret; - pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); + pll_clk = kzalloc_obj(*pll_clk, GFP_KERNEL); if (WARN_ON(!pll_clk)) return NULL; @@ -236,7 +236,7 @@ struct clk_hw *agilex_register_pll(const struct stratix10_pll_clock *clks, const char *name = clks->name; int ret; - pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); + pll_clk = kzalloc_obj(*pll_clk, GFP_KERNEL); if (WARN_ON(!pll_clk)) return NULL; @@ -275,7 +275,7 @@ struct clk_hw *n5x_register_pll(const struct stratix10_pll_clock *clks, const char *name = clks->name; int ret; - pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); + pll_clk = kzalloc_obj(*pll_clk, GFP_KERNEL); if (WARN_ON(!pll_clk)) return NULL; @@ -314,7 +314,7 @@ struct clk_hw *agilex5_register_pll(const struct agilex5_pll_clock *clks, const char *name = clks->name; int ret; - pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); + pll_clk = kzalloc_obj(*pll_clk, GFP_KERNEL); if (WARN_ON(!pll_clk)) return NULL; diff --git a/drivers/clk/socfpga/clk-pll.c b/drivers/clk/socfpga/clk-pll.c index 03a96139a576..877c7f1a4216 100644 --- a/drivers/clk/socfpga/clk-pll.c +++ b/drivers/clk/socfpga/clk-pll.c @@ -84,7 +84,7 @@ static void __init __socfpga_pll_init(struct device_node *node, of_property_read_u32(node, "reg", ®); - pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); + pll_clk = kzalloc_obj(*pll_clk, GFP_KERNEL); if (WARN_ON(!pll_clk)) return; diff --git a/drivers/clk/spacemit/ccu_common.c b/drivers/clk/spacemit/ccu_common.c index 5f05b17f8452..cbe11eb49f0b 100644 --- a/drivers/clk/spacemit/ccu_common.c +++ b/drivers/clk/spacemit/ccu_common.c @@ -91,7 +91,7 @@ static int spacemit_ccu_reset_register(struct device *dev, if (!reset_name) return 0; - cadev = kzalloc(sizeof(*cadev), GFP_KERNEL); + cadev = kzalloc_obj(*cadev, GFP_KERNEL); if (!cadev) return -ENOMEM; diff --git a/drivers/clk/spear/clk-aux-synth.c b/drivers/clk/spear/clk-aux-synth.c index d0d063147af8..6358c9d87f4d 100644 --- a/drivers/clk/spear/clk-aux-synth.c +++ b/drivers/clk/spear/clk-aux-synth.c @@ -147,7 +147,7 @@ struct clk *clk_register_aux(const char *aux_name, const char *gate_name, return ERR_PTR(-EINVAL); } - aux = kzalloc(sizeof(*aux), GFP_KERNEL); + aux = kzalloc_obj(*aux, GFP_KERNEL); if (!aux) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/spear/clk-frac-synth.c b/drivers/clk/spear/clk-frac-synth.c index 150f051d28e0..37457eb1df1d 100644 --- a/drivers/clk/spear/clk-frac-synth.c +++ b/drivers/clk/spear/clk-frac-synth.c @@ -134,7 +134,7 @@ struct clk *clk_register_frac(const char *name, const char *parent_name, return ERR_PTR(-EINVAL); } - frac = kzalloc(sizeof(*frac), GFP_KERNEL); + frac = kzalloc_obj(*frac, GFP_KERNEL); if (!frac) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/spear/clk-gpt-synth.c b/drivers/clk/spear/clk-gpt-synth.c index cf9659dc9073..dfc8c01d8a41 100644 --- a/drivers/clk/spear/clk-gpt-synth.c +++ b/drivers/clk/spear/clk-gpt-synth.c @@ -123,7 +123,7 @@ struct clk *clk_register_gpt(const char *name, const char *parent_name, unsigned return ERR_PTR(-EINVAL); } - gpt = kzalloc(sizeof(*gpt), GFP_KERNEL); + gpt = kzalloc_obj(*gpt, GFP_KERNEL); if (!gpt) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/spear/clk-vco-pll.c b/drivers/clk/spear/clk-vco-pll.c index 723a6eb67754..8b1fab349a1c 100644 --- a/drivers/clk/spear/clk-vco-pll.c +++ b/drivers/clk/spear/clk-vco-pll.c @@ -293,11 +293,11 @@ struct clk *clk_register_vco_pll(const char *vco_name, const char *pll_name, return ERR_PTR(-EINVAL); } - vco = kzalloc(sizeof(*vco), GFP_KERNEL); + vco = kzalloc_obj(*vco, GFP_KERNEL); if (!vco) return ERR_PTR(-ENOMEM); - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) goto free_vco; diff --git a/drivers/clk/sprd/pll.c b/drivers/clk/sprd/pll.c index bc6610d5fcb7..3c70a32e993f 100644 --- a/drivers/clk/sprd/pll.c +++ b/drivers/clk/sprd/pll.c @@ -155,7 +155,7 @@ static int _sprd_pll_set_rate(const struct sprd_pll *pll, unsigned long kint, nint; u64 tmp, refin, fvco = rate; - cfg = kcalloc(regs_num, sizeof(*cfg), GFP_KERNEL); + cfg = kzalloc_objs(*cfg, regs_num, GFP_KERNEL); if (!cfg) return -ENOMEM; diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c index e8e7626c76db..ea14dec68fef 100644 --- a/drivers/clk/st/clk-flexgen.c +++ b/drivers/clk/st/clk-flexgen.c @@ -213,7 +213,7 @@ static struct clk *clk_register_flexgen(const char *name, u32 xbar_shift; void __iomem *xbar_reg, *fdiv_reg; - fgxbar = kzalloc(sizeof(struct flexgen), GFP_KERNEL); + fgxbar = kzalloc_obj(struct flexgen, GFP_KERNEL); if (!fgxbar) return ERR_PTR(-ENOMEM); @@ -596,7 +596,7 @@ static void __init st_of_flexgen_setup(struct device_node *np) clk_mode = data->mode; } - clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); + clk_data = kzalloc_obj(*clk_data, GFP_KERNEL); if (!clk_data) goto err; @@ -612,12 +612,12 @@ static void __init st_of_flexgen_setup(struct device_node *np) } else clk_data->clk_num = data->outputs_nb; - clk_data->clks = kcalloc(clk_data->clk_num, sizeof(struct clk *), - GFP_KERNEL); + clk_data->clks = kzalloc_objs(struct clk *, clk_data->clk_num, + GFP_KERNEL); if (!clk_data->clks) goto err; - rlock = kzalloc(sizeof(spinlock_t), GFP_KERNEL); + rlock = kzalloc_obj(spinlock_t, GFP_KERNEL); if (!rlock) goto err; diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c index e06e7e5cc1a5..74dd344eba4f 100644 --- a/drivers/clk/st/clkgen-fsyn.c +++ b/drivers/clk/st/clkgen-fsyn.c @@ -454,7 +454,7 @@ static struct clk * __init st_clk_register_quadfs_pll( if (WARN_ON(!name || !parent_name)) return ERR_PTR(-EINVAL); - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); @@ -894,7 +894,7 @@ static struct clk * __init st_clk_register_quadfs_fsynth( if (WARN_ON(!name || !parent_name)) return ERR_PTR(-EINVAL); - fs = kzalloc(sizeof(*fs), GFP_KERNEL); + fs = kzalloc_obj(*fs, GFP_KERNEL); if (!fs) return ERR_PTR(-ENOMEM); @@ -926,13 +926,12 @@ static void __init st_of_create_quadfs_fsynths( struct clk_onecell_data *clk_data; int fschan; - clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); + clk_data = kzalloc_obj(*clk_data, GFP_KERNEL); if (!clk_data) return; clk_data->clk_num = QUADFS_MAX_CHAN; - clk_data->clks = kcalloc(QUADFS_MAX_CHAN, sizeof(struct clk *), - GFP_KERNEL); + clk_data->clks = kzalloc_objs(struct clk *, QUADFS_MAX_CHAN, GFP_KERNEL); if (!clk_data->clks) { kfree(clk_data); @@ -1013,7 +1012,7 @@ static void __init st_of_quadfs_setup(struct device_node *np, if (!pll_name) return; - lock = kzalloc(sizeof(*lock), GFP_KERNEL); + lock = kzalloc_obj(*lock, GFP_KERNEL); if (!lock) goto err_exit; diff --git a/drivers/clk/st/clkgen-pll.c b/drivers/clk/st/clkgen-pll.c index c258ff87a171..9a6b0df5aabc 100644 --- a/drivers/clk/st/clkgen-pll.c +++ b/drivers/clk/st/clkgen-pll.c @@ -656,7 +656,7 @@ static struct clk * __init clkgen_pll_register(const char *parent_name, struct clk *clk; struct clk_init_data init; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); @@ -716,7 +716,7 @@ static struct clk * __init clkgen_odf_register(const char *parent_name, flags = pll_flags | CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); @@ -725,7 +725,7 @@ static struct clk * __init clkgen_odf_register(const char *parent_name, gate->bit_idx = pll_data->odf_gate[odf].shift; gate->lock = odf_lock; - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) { kfree(gate); return ERR_PTR(-ENOMEM); @@ -783,13 +783,13 @@ static void __init clkgen_c32_pll_setup(struct device_node *np, num_odfs = datac->data->num_odfs; - clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); + clk_data = kzalloc_obj(*clk_data, GFP_KERNEL); if (!clk_data) return; clk_data->clk_num = num_odfs; - clk_data->clks = kcalloc(clk_data->clk_num, sizeof(struct clk *), - GFP_KERNEL); + clk_data->clks = kzalloc_objs(struct clk *, clk_data->clk_num, + GFP_KERNEL); if (!clk_data->clks) goto err; diff --git a/drivers/clk/starfive/clk-starfive-jh7110-sys.c b/drivers/clk/starfive/clk-starfive-jh7110-sys.c index 52833d4241c5..d8a1e45fc6bd 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-sys.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-sys.c @@ -347,7 +347,7 @@ int jh7110_reset_controller_register(struct jh71x0_clk_priv *priv, struct auxiliary_device *adev; int ret; - rdev = kzalloc(sizeof(*rdev), GFP_KERNEL); + rdev = kzalloc_obj(*rdev, GFP_KERNEL); if (!rdev) return -ENOMEM; diff --git a/drivers/clk/stm32/reset-stm32.c b/drivers/clk/stm32/reset-stm32.c index 5a8f525842ce..6c4a3a1bfa38 100644 --- a/drivers/clk/stm32/reset-stm32.c +++ b/drivers/clk/stm32/reset-stm32.c @@ -130,7 +130,7 @@ int stm32_rcc_reset_init(struct device *dev, struct clk_stm32_reset_data *data, { struct stm32_reset_data *reset_data; - reset_data = kzalloc(sizeof(*reset_data), GFP_KERNEL); + reset_data = kzalloc_obj(*reset_data, GFP_KERNEL); if (!reset_data) return -ENOMEM; diff --git a/drivers/clk/sunxi-ng/ccu_common.c b/drivers/clk/sunxi-ng/ccu_common.c index c7e00f0c29a5..eff61cb0d8a5 100644 --- a/drivers/clk/sunxi-ng/ccu_common.c +++ b/drivers/clk/sunxi-ng/ccu_common.c @@ -242,7 +242,7 @@ void of_sunxi_ccu_probe(struct device_node *node, void __iomem *reg, struct sunxi_ccu *ccu; int ret; - ccu = kzalloc(sizeof(*ccu), GFP_KERNEL); + ccu = kzalloc_obj(*ccu, GFP_KERNEL); if (!ccu) return; diff --git a/drivers/clk/sunxi/clk-a10-hosc.c b/drivers/clk/sunxi/clk-a10-hosc.c index f07e976839eb..3a0d899c395a 100644 --- a/drivers/clk/sunxi/clk-a10-hosc.c +++ b/drivers/clk/sunxi/clk-a10-hosc.c @@ -26,10 +26,10 @@ static void __init sun4i_osc_clk_setup(struct device_node *node) return; /* allocate fixed-rate and gate clock structs */ - fixed = kzalloc(sizeof(struct clk_fixed_rate), GFP_KERNEL); + fixed = kzalloc_obj(struct clk_fixed_rate, GFP_KERNEL); if (!fixed) return; - gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL); + gate = kzalloc_obj(struct clk_gate, GFP_KERNEL); if (!gate) goto err_free_fixed; diff --git a/drivers/clk/sunxi/clk-a10-mod1.c b/drivers/clk/sunxi/clk-a10-mod1.c index 39ad56d753ba..45dfe0b2e8d1 100644 --- a/drivers/clk/sunxi/clk-a10-mod1.c +++ b/drivers/clk/sunxi/clk-a10-mod1.c @@ -32,11 +32,11 @@ static void __init sun4i_mod1_clk_setup(struct device_node *node) if (IS_ERR(reg)) return; - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) goto err_unmap; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) goto err_free_mux; diff --git a/drivers/clk/sunxi/clk-a10-pll2.c b/drivers/clk/sunxi/clk-a10-pll2.c index 2ea3b42320a6..046e23831fc2 100644 --- a/drivers/clk/sunxi/clk-a10-pll2.c +++ b/drivers/clk/sunxi/clk-a10-pll2.c @@ -50,11 +50,11 @@ static void __init sun4i_pll2_setup(struct device_node *node, if (IS_ERR(reg)) return; - clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); + clk_data = kzalloc_obj(*clk_data, GFP_KERNEL); if (!clk_data) goto err_unmap; - clks = kcalloc(SUN4I_PLL2_OUTPUTS, sizeof(struct clk *), GFP_KERNEL); + clks = kzalloc_objs(struct clk *, SUN4I_PLL2_OUTPUTS, GFP_KERNEL); if (!clks) goto err_free_data; @@ -71,7 +71,7 @@ static void __init sun4i_pll2_setup(struct device_node *node, } /* Setup the gate part of the PLL2 */ - gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL); + gate = kzalloc_obj(struct clk_gate, GFP_KERNEL); if (!gate) goto err_unregister_prediv; @@ -80,7 +80,7 @@ static void __init sun4i_pll2_setup(struct device_node *node, gate->lock = &sun4i_a10_pll2_lock; /* Setup the multiplier part of the PLL2 */ - mult = kzalloc(sizeof(struct clk_multiplier), GFP_KERNEL); + mult = kzalloc_obj(struct clk_multiplier, GFP_KERNEL); if (!mult) goto err_free_gate; diff --git a/drivers/clk/sunxi/clk-a10-ve.c b/drivers/clk/sunxi/clk-a10-ve.c index 65810937a13a..d353d0d1200a 100644 --- a/drivers/clk/sunxi/clk-a10-ve.c +++ b/drivers/clk/sunxi/clk-a10-ve.c @@ -97,11 +97,11 @@ static void __init sun4i_ve_clk_setup(struct device_node *node) if (IS_ERR(reg)) return; - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) goto err_unmap; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) goto err_free_div; @@ -129,7 +129,7 @@ static void __init sun4i_ve_clk_setup(struct device_node *node) if (err) goto err_unregister_clk; - reset_data = kzalloc(sizeof(*reset_data), GFP_KERNEL); + reset_data = kzalloc_obj(*reset_data, GFP_KERNEL); if (!reset_data) goto err_del_provider; diff --git a/drivers/clk/sunxi/clk-a20-gmac.c b/drivers/clk/sunxi/clk-a20-gmac.c index 43080c7d045b..3ef842034fa2 100644 --- a/drivers/clk/sunxi/clk-a20-gmac.c +++ b/drivers/clk/sunxi/clk-a20-gmac.c @@ -63,11 +63,11 @@ static void __init sun7i_a20_gmac_clk_setup(struct device_node *node) return; /* allocate mux and gate clock structs */ - mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL); + mux = kzalloc_obj(struct clk_mux, GFP_KERNEL); if (!mux) return; - gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL); + gate = kzalloc_obj(struct clk_gate, GFP_KERNEL); if (!gate) goto free_mux; diff --git a/drivers/clk/sunxi/clk-factors.c b/drivers/clk/sunxi/clk-factors.c index 4d8f0422b876..0b4a25305e93 100644 --- a/drivers/clk/sunxi/clk-factors.c +++ b/drivers/clk/sunxi/clk-factors.c @@ -200,7 +200,7 @@ static struct clk *__sunxi_factors_register(struct device_node *node, else of_property_read_string(node, "clock-output-names", &clk_name); - factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL); + factors = kzalloc_obj(struct clk_factors, GFP_KERNEL); if (!factors) goto err_factors; @@ -213,7 +213,7 @@ static struct clk *__sunxi_factors_register(struct device_node *node, /* Add a gate if this factor clock can be gated */ if (data->enable) { - gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL); + gate = kzalloc_obj(struct clk_gate, GFP_KERNEL); if (!gate) goto err_gate; @@ -228,7 +228,7 @@ static struct clk *__sunxi_factors_register(struct device_node *node, /* Add a mux if this factor clock can be muxed */ if (data->mux) { - mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL); + mux = kzalloc_obj(struct clk_mux, GFP_KERNEL); if (!mux) goto err_mux; diff --git a/drivers/clk/sunxi/clk-mod0.c b/drivers/clk/sunxi/clk-mod0.c index 51800289ada9..dcfaa8a936c4 100644 --- a/drivers/clk/sunxi/clk-mod0.c +++ b/drivers/clk/sunxi/clk-mod0.c @@ -300,11 +300,11 @@ static void __init sunxi_mmc_setup(struct device_node *node, return; } - clk_data = kmalloc(sizeof(*clk_data), GFP_KERNEL); + clk_data = kmalloc_obj(*clk_data, GFP_KERNEL); if (!clk_data) return; - clk_data->clks = kcalloc(3, sizeof(*clk_data->clks), GFP_KERNEL); + clk_data->clks = kzalloc_objs(*clk_data->clks, 3, GFP_KERNEL); if (!clk_data->clks) goto err_free_data; @@ -323,7 +323,7 @@ static void __init sunxi_mmc_setup(struct device_node *node, }; struct mmc_phase *phase; - phase = kmalloc(sizeof(*phase), GFP_KERNEL); + phase = kmalloc_obj(*phase, GFP_KERNEL); if (!phase) continue; diff --git a/drivers/clk/sunxi/clk-simple-gates.c b/drivers/clk/sunxi/clk-simple-gates.c index 845efc1ec800..3852972a8600 100644 --- a/drivers/clk/sunxi/clk-simple-gates.c +++ b/drivers/clk/sunxi/clk-simple-gates.c @@ -34,14 +34,14 @@ static void __init sunxi_simple_gates_setup(struct device_node *node, clk_parent = of_clk_get_parent_name(node, 0); - clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL); + clk_data = kmalloc_obj(struct clk_onecell_data, GFP_KERNEL); if (!clk_data) goto err_unmap; number = of_property_count_u32_elems(node, "clock-indices"); of_property_read_u32_index(node, "clock-indices", number - 1, &number); - clk_data->clks = kcalloc(number + 1, sizeof(struct clk *), GFP_KERNEL); + clk_data->clks = kzalloc_objs(struct clk *, number + 1, GFP_KERNEL); if (!clk_data->clks) goto err_free_data; diff --git a/drivers/clk/sunxi/clk-sun4i-display.c b/drivers/clk/sunxi/clk-sun4i-display.c index 35d1541bedd9..a4e00d516b68 100644 --- a/drivers/clk/sunxi/clk-sun4i-display.c +++ b/drivers/clk/sunxi/clk-sun4i-display.c @@ -126,7 +126,7 @@ static void __init sun4i_a10_display_init(struct device_node *node, goto unmap; } - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) goto unmap; @@ -135,7 +135,7 @@ static void __init sun4i_a10_display_init(struct device_node *node, mux->mask = (1 << data->width_mux) - 1; mux->lock = &sun4i_a10_display_lock; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) goto free_mux; @@ -144,7 +144,7 @@ static void __init sun4i_a10_display_init(struct device_node *node, gate->lock = &sun4i_a10_display_lock; if (data->has_div) { - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) goto free_gate; @@ -175,7 +175,7 @@ static void __init sun4i_a10_display_init(struct device_node *node, if (!data->num_rst) return; - reset_data = kzalloc(sizeof(*reset_data), GFP_KERNEL); + reset_data = kzalloc_obj(*reset_data, GFP_KERNEL); if (!reset_data) goto free_of_clk; diff --git a/drivers/clk/sunxi/clk-sun4i-pll3.c b/drivers/clk/sunxi/clk-sun4i-pll3.c index 5328588fa2de..2977e71ea35a 100644 --- a/drivers/clk/sunxi/clk-sun4i-pll3.c +++ b/drivers/clk/sunxi/clk-sun4i-pll3.c @@ -37,7 +37,7 @@ static void __init sun4i_a10_pll3_setup(struct device_node *node) return; } - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) goto err_unmap; @@ -45,7 +45,7 @@ static void __init sun4i_a10_pll3_setup(struct device_node *node) gate->bit_idx = SUN4I_A10_PLL3_GATE_BIT; gate->lock = &sun4i_a10_pll3_lock; - mult = kzalloc(sizeof(*mult), GFP_KERNEL); + mult = kzalloc_obj(*mult, GFP_KERNEL); if (!mult) goto err_free_gate; diff --git a/drivers/clk/sunxi/clk-sun4i-tcon-ch1.c b/drivers/clk/sunxi/clk-sun4i-tcon-ch1.c index 277a240b65a1..6e4c9db335e6 100644 --- a/drivers/clk/sunxi/clk-sun4i-tcon-ch1.c +++ b/drivers/clk/sunxi/clk-sun4i-tcon-ch1.c @@ -246,7 +246,7 @@ static void __init tcon_ch1_setup(struct device_node *node) goto err_unmap; } - tclk = kzalloc(sizeof(*tclk), GFP_KERNEL); + tclk = kzalloc_obj(*tclk, GFP_KERNEL); if (!tclk) goto err_unmap; diff --git a/drivers/clk/sunxi/clk-sun8i-bus-gates.c b/drivers/clk/sunxi/clk-sun8i-bus-gates.c index 8482ac8e5898..c212200d49f4 100644 --- a/drivers/clk/sunxi/clk-sun8i-bus-gates.c +++ b/drivers/clk/sunxi/clk-sun8i-bus-gates.c @@ -44,14 +44,14 @@ static void __init sun8i_h3_bus_gates_init(struct device_node *node) parents[i] = of_clk_get_parent_name(node, idx); } - clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL); + clk_data = kmalloc_obj(struct clk_onecell_data, GFP_KERNEL); if (!clk_data) goto err_unmap; number = of_property_count_u32_elems(node, "clock-indices"); of_property_read_u32_index(node, "clock-indices", number - 1, &number); - clk_data->clks = kcalloc(number + 1, sizeof(struct clk *), GFP_KERNEL); + clk_data->clks = kzalloc_objs(struct clk *, number + 1, GFP_KERNEL); if (!clk_data->clks) goto err_free_data; diff --git a/drivers/clk/sunxi/clk-sun8i-mbus.c b/drivers/clk/sunxi/clk-sun8i-mbus.c index 539ea278823d..9156830f04a6 100644 --- a/drivers/clk/sunxi/clk-sun8i-mbus.c +++ b/drivers/clk/sunxi/clk-sun8i-mbus.c @@ -44,15 +44,15 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) goto err_free_parents; } - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) goto err_unmap; - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) goto err_free_div; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) goto err_free_mux; diff --git a/drivers/clk/sunxi/clk-sun9i-cpus.c b/drivers/clk/sunxi/clk-sun9i-cpus.c index 48bf899bb2bc..f49f4df71bc2 100644 --- a/drivers/clk/sunxi/clk-sun9i-cpus.c +++ b/drivers/clk/sunxi/clk-sun9i-cpus.c @@ -191,7 +191,7 @@ static void sun9i_a80_cpus_setup(struct device_node *node) struct clk *clk; int ret; - cpus = kzalloc(sizeof(*cpus), GFP_KERNEL); + cpus = kzalloc_obj(*cpus, GFP_KERNEL); if (!cpus) return; @@ -204,7 +204,7 @@ static void sun9i_a80_cpus_setup(struct device_node *node) /* we have a mux, we will have >1 parents */ ret = of_clk_parent_fill(node, parents, SUN9I_CPUS_MAX_PARENTS); - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) goto err_unmap; diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c index 4999504f7e60..1451ebec1ac6 100644 --- a/drivers/clk/sunxi/clk-sunxi.c +++ b/drivers/clk/sunxi/clk-sunxi.c @@ -991,11 +991,11 @@ static struct clk ** __init sunxi_divs_clk_setup(struct device_node *node, return NULL; } - clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL); + clk_data = kmalloc_obj(struct clk_onecell_data, GFP_KERNEL); if (!clk_data) goto out_unmap; - clks = kcalloc(ndivs, sizeof(*clks), GFP_KERNEL); + clks = kzalloc_objs(*clks, ndivs, GFP_KERNEL); if (!clks) goto free_clkdata; @@ -1022,7 +1022,7 @@ static struct clk ** __init sunxi_divs_clk_setup(struct device_node *node, /* If this leaf clock can be gated, create a gate */ if (data->div[i].gate) { - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) goto free_clks; @@ -1035,7 +1035,7 @@ static struct clk ** __init sunxi_divs_clk_setup(struct device_node *node, /* Leaves can be fixed or configurable divisors */ if (data->div[i].fixed) { - fix_factor = kzalloc(sizeof(*fix_factor), GFP_KERNEL); + fix_factor = kzalloc_obj(*fix_factor, GFP_KERNEL); if (!fix_factor) goto free_gate; @@ -1045,7 +1045,7 @@ static struct clk ** __init sunxi_divs_clk_setup(struct device_node *node, rate_hw = &fix_factor->hw; rate_ops = &clk_fixed_factor_ops; } else { - divider = kzalloc(sizeof(*divider), GFP_KERNEL); + divider = kzalloc_obj(*divider, GFP_KERNEL); if (!divider) goto free_gate; diff --git a/drivers/clk/sunxi/clk-usb.c b/drivers/clk/sunxi/clk-usb.c index 3c53f65002a2..f993884c58d6 100644 --- a/drivers/clk/sunxi/clk-usb.c +++ b/drivers/clk/sunxi/clk-usb.c @@ -113,11 +113,11 @@ static void __init sunxi_usb_clk_setup(struct device_node *node, qty = find_last_bit((unsigned long *)&data->clk_mask, SUNXI_USB_MAX_SIZE); - clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL); + clk_data = kmalloc_obj(struct clk_onecell_data, GFP_KERNEL); if (!clk_data) return; - clk_data->clks = kcalloc(qty + 1, sizeof(struct clk *), GFP_KERNEL); + clk_data->clks = kzalloc_objs(struct clk *, qty + 1, GFP_KERNEL); if (!clk_data->clks) { kfree(clk_data); return; @@ -144,7 +144,7 @@ static void __init sunxi_usb_clk_setup(struct device_node *node, if (data->reset_mask == 0) return; - reset_data = kzalloc(sizeof(*reset_data), GFP_KERNEL); + reset_data = kzalloc_obj(*reset_data, GFP_KERNEL); if (!reset_data) return; diff --git a/drivers/clk/tegra/clk-audio-sync.c b/drivers/clk/tegra/clk-audio-sync.c index 468a4403f147..41db1d5978e3 100644 --- a/drivers/clk/tegra/clk-audio-sync.c +++ b/drivers/clk/tegra/clk-audio-sync.c @@ -50,7 +50,7 @@ struct clk *tegra_clk_register_sync_source(const char *name, struct clk_init_data init; struct clk *clk; - sync = kzalloc(sizeof(*sync), GFP_KERNEL); + sync = kzalloc_obj(*sync, GFP_KERNEL); if (!sync) { pr_err("%s: could not allocate sync source clk\n", __func__); return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c index 77a2586dbe00..064d9ee431e5 100644 --- a/drivers/clk/tegra/clk-bpmp.c +++ b/drivers/clk/tegra/clk-bpmp.c @@ -434,7 +434,7 @@ static int tegra_bpmp_probe_clocks(struct tegra_bpmp *bpmp, dev_dbg(bpmp->dev, "maximum clock ID: %u\n", max_id); - clocks = kcalloc(max_id + 1, sizeof(*clocks), GFP_KERNEL); + clocks = kzalloc_objs(*clocks, max_id + 1, GFP_KERNEL); if (!clocks) return -ENOMEM; diff --git a/drivers/clk/tegra/clk-divider.c b/drivers/clk/tegra/clk-divider.c index 37439fcb3ac0..62fd39a849b1 100644 --- a/drivers/clk/tegra/clk-divider.c +++ b/drivers/clk/tegra/clk-divider.c @@ -148,7 +148,7 @@ struct clk *tegra_clk_register_divider(const char *name, struct clk *clk; struct clk_init_data init; - divider = kzalloc(sizeof(*divider), GFP_KERNEL); + divider = kzalloc_obj(*divider, GFP_KERNEL); if (!divider) { pr_err("%s: could not allocate fractional divider clk\n", __func__); diff --git a/drivers/clk/tegra/clk-periph-fixed.c b/drivers/clk/tegra/clk-periph-fixed.c index c088e7a280df..363a0e0aed3d 100644 --- a/drivers/clk/tegra/clk-periph-fixed.c +++ b/drivers/clk/tegra/clk-periph-fixed.c @@ -84,7 +84,7 @@ struct clk *tegra_clk_register_periph_fixed(const char *name, if (!regs) return ERR_PTR(-EINVAL); - fixed = kzalloc(sizeof(*fixed), GFP_KERNEL); + fixed = kzalloc_obj(*fixed, GFP_KERNEL); if (!fixed) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/tegra/clk-periph-gate.c b/drivers/clk/tegra/clk-periph-gate.c index 2091fc9b0ca9..1892a5b78fc7 100644 --- a/drivers/clk/tegra/clk-periph-gate.c +++ b/drivers/clk/tegra/clk-periph-gate.c @@ -146,7 +146,7 @@ struct clk *tegra_clk_register_periph_gate(const char *name, if (!pregs) return ERR_PTR(-EINVAL); - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) { pr_err("%s: could not allocate periph gate clk\n", __func__); return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/tegra/clk-pll-out.c b/drivers/clk/tegra/clk-pll-out.c index d8bf89a81e6d..cf10c7bea32d 100644 --- a/drivers/clk/tegra/clk-pll-out.c +++ b/drivers/clk/tegra/clk-pll-out.c @@ -93,7 +93,7 @@ struct clk *tegra_clk_register_pll_out(const char *name, struct clk *clk; struct clk_init_data init; - pll_out = kzalloc(sizeof(*pll_out), GFP_KERNEL); + pll_out = kzalloc_obj(*pll_out, GFP_KERNEL); if (!pll_out) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c index 591b9f0c155a..3031725e2a9d 100644 --- a/drivers/clk/tegra/clk-pll.c +++ b/drivers/clk/tegra/clk-pll.c @@ -1882,7 +1882,7 @@ static struct tegra_clk_pll *_tegra_init_pll(void __iomem *clk_base, { struct tegra_clk_pll *pll; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/tegra/clk-sdmmc-mux.c b/drivers/clk/tegra/clk-sdmmc-mux.c index 4f2c3309eea4..524469ff0805 100644 --- a/drivers/clk/tegra/clk-sdmmc-mux.c +++ b/drivers/clk/tegra/clk-sdmmc-mux.c @@ -250,7 +250,7 @@ struct clk *tegra_clk_register_sdmmc_mux_div(const char *name, if (!bank) return ERR_PTR(-EINVAL); - sdmmc_mux = kzalloc(sizeof(*sdmmc_mux), GFP_KERNEL); + sdmmc_mux = kzalloc_obj(*sdmmc_mux, GFP_KERNEL); if (!sdmmc_mux) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c index 51fb356e770e..3882efd05427 100644 --- a/drivers/clk/tegra/clk-super.c +++ b/drivers/clk/tegra/clk-super.c @@ -207,7 +207,7 @@ struct clk *tegra_clk_register_super_mux(const char *name, struct clk *clk; struct clk_init_data init; - super = kzalloc(sizeof(*super), GFP_KERNEL); + super = kzalloc_obj(*super, GFP_KERNEL); if (!super) return ERR_PTR(-ENOMEM); @@ -243,7 +243,7 @@ struct clk *tegra_clk_register_super_clk(const char *name, struct clk *clk; struct clk_init_data init; - super = kzalloc(sizeof(*super), GFP_KERNEL); + super = kzalloc_obj(*super, GFP_KERNEL); if (!super) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/tegra/clk-tegra-super-cclk.c b/drivers/clk/tegra/clk-tegra-super-cclk.c index 3b22a4d0dffc..0f4ec781024c 100644 --- a/drivers/clk/tegra/clk-tegra-super-cclk.c +++ b/drivers/clk/tegra/clk-tegra-super-cclk.c @@ -142,7 +142,7 @@ struct clk *tegra_clk_register_super_cclk(const char *name, if (WARN_ON(cclk_super)) return ERR_PTR(-EBUSY); - super = kzalloc(sizeof(*super), GFP_KERNEL); + super = kzalloc_obj(*super, GFP_KERNEL); if (!super) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/tegra/clk-tegra124-emc.c b/drivers/clk/tegra/clk-tegra124-emc.c index 8aec327fa1f4..c92fc64c79dc 100644 --- a/drivers/clk/tegra/clk-tegra124-emc.c +++ b/drivers/clk/tegra/clk-tegra124-emc.c @@ -492,7 +492,7 @@ struct clk *tegra124_clk_register_emc(void __iomem *base, struct device_node *np struct clk *clk; int err; - tegra = kcalloc(1, sizeof(*tegra), GFP_KERNEL); + tegra = kzalloc_objs(*tegra, 1, GFP_KERNEL); if (!tegra) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/tegra/clk-tegra20-emc.c b/drivers/clk/tegra/clk-tegra20-emc.c index dd74b8543bf1..20efe7827d27 100644 --- a/drivers/clk/tegra/clk-tegra20-emc.c +++ b/drivers/clk/tegra/clk-tegra20-emc.c @@ -249,7 +249,7 @@ struct clk *tegra20_clk_register_emc(void __iomem *ioaddr, bool low_jitter) struct clk_init_data init; struct clk *clk; - emc = kzalloc(sizeof(*emc), GFP_KERNEL); + emc = kzalloc_obj(*emc, GFP_KERNEL); if (!emc) return NULL; diff --git a/drivers/clk/tegra/clk-tegra210-emc.c b/drivers/clk/tegra/clk-tegra210-emc.c index fbf3c894eb56..9e88cd587183 100644 --- a/drivers/clk/tegra/clk-tegra210-emc.c +++ b/drivers/clk/tegra/clk-tegra210-emc.c @@ -278,7 +278,7 @@ struct clk *tegra210_clk_register_emc(struct device_node *np, struct clk_init_data init; struct clk *clk; - emc = kzalloc(sizeof(*emc), GFP_KERNEL); + emc = kzalloc_obj(*emc, GFP_KERNEL); if (!emc) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/tegra/clk-tegra210.c b/drivers/clk/tegra/clk-tegra210.c index 504d0ea997a5..ad21a735723e 100644 --- a/drivers/clk/tegra/clk-tegra210.c +++ b/drivers/clk/tegra/clk-tegra210.c @@ -3705,8 +3705,7 @@ static void tegra210_mbist_clk_init(void) if (!num_clks) continue; - clk_data = kmalloc_array(num_clks, sizeof(*clk_data), - GFP_KERNEL); + clk_data = kmalloc_objs(*clk_data, num_clks, GFP_KERNEL); if (WARN_ON(!clk_data)) return; diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c index 19037346f522..7f11d1795d79 100644 --- a/drivers/clk/tegra/clk.c +++ b/drivers/clk/tegra/clk.c @@ -227,15 +227,14 @@ struct clk ** __init tegra_clk_init(void __iomem *regs, int num, int banks) if (WARN_ON(banks > ARRAY_SIZE(periph_regs))) return NULL; - periph_clk_enb_refcnt = kcalloc(32 * banks, - sizeof(*periph_clk_enb_refcnt), - GFP_KERNEL); + periph_clk_enb_refcnt = kzalloc_objs(*periph_clk_enb_refcnt, 32 * banks, + GFP_KERNEL); if (!periph_clk_enb_refcnt) return NULL; periph_banks = banks; - clks = kcalloc(num, sizeof(struct clk *), GFP_KERNEL); + clks = kzalloc_objs(struct clk *, num, GFP_KERNEL); if (!clks) { kfree(periph_clk_enb_refcnt); return NULL; diff --git a/drivers/clk/ti/apll.c b/drivers/clk/ti/apll.c index 43514e6f3b78..5ec7cfd5e669 100644 --- a/drivers/clk/ti/apll.c +++ b/drivers/clk/ti/apll.c @@ -183,9 +183,9 @@ static void __init of_dra7_apll_setup(struct device_node *node) const char **parent_names = NULL; int ret; - ad = kzalloc(sizeof(*ad), GFP_KERNEL); - clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); - init = kzalloc(sizeof(*init), GFP_KERNEL); + ad = kzalloc_obj(*ad, GFP_KERNEL); + clk_hw = kzalloc_obj(*clk_hw, GFP_KERNEL); + init = kzalloc_obj(*init, GFP_KERNEL); if (!ad || !clk_hw || !init) goto cleanup; @@ -347,9 +347,9 @@ static void __init of_omap2_apll_setup(struct device_node *node) u32 val; int ret; - ad = kzalloc(sizeof(*ad), GFP_KERNEL); - clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); - init = kzalloc(sizeof(*init), GFP_KERNEL); + ad = kzalloc_obj(*ad, GFP_KERNEL); + clk_hw = kzalloc_obj(*clk_hw, GFP_KERNEL); + init = kzalloc_obj(*init, GFP_KERNEL); if (!ad || !clk_hw || !init) goto cleanup; diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c index a99aaf2e7684..62b136861f95 100644 --- a/drivers/clk/ti/autoidle.c +++ b/drivers/clk/ti/autoidle.c @@ -191,7 +191,7 @@ int __init of_ti_clk_autoidle_setup(struct device_node *node) if (of_property_read_u32(node, "ti,autoidle-shift", &shift)) return 0; - clk = kzalloc(sizeof(*clk), GFP_KERNEL); + clk = kzalloc_obj(*clk, GFP_KERNEL); if (!clk) return -ENOMEM; diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c index b02f84d49b96..fd41aa9fbab1 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c @@ -170,7 +170,7 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node) const char *name; struct clk *clk; - clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); + clk_hw = kzalloc_obj(*clk_hw, GFP_KERNEL); if (!clk_hw) { pr_err("%s: could not allocate dra7_atl_desc\n", __func__); return; diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c index 693a4459a01b..23ab4f380956 100644 --- a/drivers/clk/ti/clk.c +++ b/drivers/clk/ti/clk.c @@ -268,7 +268,7 @@ int __init ti_clk_retry_init(struct device_node *node, void *user, struct clk_init_item *retry; pr_debug("%pOFn: adding to retry list...\n", node); - retry = kzalloc(sizeof(*retry), GFP_KERNEL); + retry = kzalloc_obj(*retry, GFP_KERNEL); if (!retry) return -ENOMEM; @@ -411,7 +411,7 @@ int __init omap2_clk_provider_init(struct device_node *parent, int index, /* add clocks node info */ clocks_node_ptr[index] = clocks; - io = kzalloc(sizeof(*io), GFP_KERNEL); + io = kzalloc_obj(*io, GFP_KERNEL); if (!io) return -ENOMEM; @@ -576,7 +576,7 @@ int ti_clk_add_alias(struct clk *clk, const char *con) if (IS_ERR(clk)) return PTR_ERR(clk); - cl = kzalloc(sizeof(*cl), GFP_KERNEL); + cl = kzalloc_obj(*cl, GFP_KERNEL); if (!cl) return -ENOMEM; diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c index 607e34d8e289..06a39d981733 100644 --- a/drivers/clk/ti/clkctrl.c +++ b/drivers/clk/ti/clkctrl.c @@ -297,7 +297,7 @@ _ti_clkctrl_clk_register(struct omap_clkctrl_provider *provider, ti_clk_get_features()->flags & TI_CLK_CLKCTRL_COMPAT); - clkctrl_clk = kzalloc(sizeof(*clkctrl_clk), GFP_KERNEL); + clkctrl_clk = kzalloc_obj(*clkctrl_clk, GFP_KERNEL); if (!init.name || !clkctrl_clk) { ret = -ENOMEM; goto cleanup; @@ -337,7 +337,7 @@ _ti_clkctrl_setup_gate(struct omap_clkctrl_provider *provider, { struct clk_hw_omap *clk_hw; - clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); + clk_hw = kzalloc_obj(*clk_hw, GFP_KERNEL); if (!clk_hw) return; @@ -360,7 +360,7 @@ _ti_clkctrl_setup_mux(struct omap_clkctrl_provider *provider, int num_parents = 0; const char * const *pname; - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return; @@ -395,7 +395,7 @@ _ti_clkctrl_setup_div(struct omap_clkctrl_provider *provider, const struct omap_clkctrl_div_data *div_data = data->data; u8 div_flags = 0; - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return; @@ -579,7 +579,7 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node) return; } - provider = kzalloc(sizeof(*provider), GFP_KERNEL); + provider = kzalloc_obj(*provider, GFP_KERNEL); if (!provider) return; @@ -650,7 +650,7 @@ clkdm_found: continue; } - hw = kzalloc(sizeof(*hw), GFP_KERNEL); + hw = kzalloc_obj(*hw, GFP_KERNEL); if (!hw) return; @@ -683,7 +683,7 @@ clkdm_found: if (!init.name) goto cleanup; - clkctrl_clk = kzalloc(sizeof(*clkctrl_clk), GFP_KERNEL); + clkctrl_clk = kzalloc_obj(*clkctrl_clk, GFP_KERNEL); if (!clkctrl_clk) goto cleanup; diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c index 8cba259188d4..0403995cd8ac 100644 --- a/drivers/clk/ti/composite.c +++ b/drivers/clk/ti/composite.c @@ -211,7 +211,7 @@ static void __init of_ti_composite_clk_setup(struct device_node *node) return; } - cclk = kzalloc(sizeof(*cclk), GFP_KERNEL); + cclk = kzalloc_obj(*cclk, GFP_KERNEL); if (!cclk) return; @@ -253,7 +253,7 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw, of_clk_parent_fill(node, parent_names, num_parents); - clk = kzalloc(sizeof(*clk), GFP_KERNEL); + clk = kzalloc_obj(*clk, GFP_KERNEL); if (!clk) { kfree(parent_names); return -ENOMEM; diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c index 6f58a0f2e74a..af2776f13413 100644 --- a/drivers/clk/ti/divider.c +++ b/drivers/clk/ti/divider.c @@ -357,7 +357,7 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div, num_dividers = i; - tmp = kcalloc(valid_div + 1, sizeof(*tmp), GFP_KERNEL); + tmp = kzalloc_objs(*tmp, valid_div + 1, GFP_KERNEL); if (!tmp) return -ENOMEM; @@ -413,7 +413,7 @@ static int __init ti_clk_get_div_table(struct device_node *node, return -EINVAL; } - table = kcalloc(valid_div + 1, sizeof(*table), GFP_KERNEL); + table = kzalloc_objs(*table, valid_div + 1, GFP_KERNEL); if (!table) return -ENOMEM; @@ -517,7 +517,7 @@ static void __init of_ti_divider_clk_setup(struct device_node *node) u32 flags = 0; struct clk_omap_divider *div; - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return; @@ -542,7 +542,7 @@ static void __init of_ti_composite_divider_clk_setup(struct device_node *node) struct clk_omap_divider *div; u32 tmp; - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return; diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c index 971adafd9a8b..bce9af95d7aa 100644 --- a/drivers/clk/ti/dpll.c +++ b/drivers/clk/ti/dpll.c @@ -222,7 +222,7 @@ static void _register_dpll_x2(struct device_node *node, return; } - clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); + clk_hw = kzalloc_obj(*clk_hw, GFP_KERNEL); if (!clk_hw) return; @@ -281,8 +281,8 @@ static void __init of_ti_dpll_setup(struct device_node *node, u32 min_div; dd = kmemdup(ddt, sizeof(*dd), GFP_KERNEL); - clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); - init = kzalloc(sizeof(*init), GFP_KERNEL); + clk_hw = kzalloc_obj(*clk_hw, GFP_KERNEL); + init = kzalloc_obj(*init, GFP_KERNEL); if (!dd || !clk_hw || !init) goto cleanup; diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c index 4f28138d2d8a..22be4570b038 100644 --- a/drivers/clk/ti/fapll.c +++ b/drivers/clk/ti/fapll.c @@ -499,7 +499,7 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, struct fapll_synth *synth; struct clk *clk = ERR_PTR(-ENOMEM); - init = kzalloc(sizeof(*init), GFP_KERNEL); + init = kzalloc_obj(*init, GFP_KERNEL); if (!init) return ERR_PTR(-ENOMEM); @@ -508,7 +508,7 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, init->parent_names = &parent; init->num_parents = 1; - synth = kzalloc(sizeof(*synth), GFP_KERNEL); + synth = kzalloc_obj(*synth, GFP_KERNEL); if (!synth) goto free; @@ -544,7 +544,7 @@ static void __init ti_fapll_setup(struct device_node *node) const char *name; int i; - fd = kzalloc(sizeof(*fd), GFP_KERNEL); + fd = kzalloc_obj(*fd, GFP_KERNEL); if (!fd) return; @@ -554,7 +554,7 @@ static void __init ti_fapll_setup(struct device_node *node) if (!fd->outputs.clks) goto free; - init = kzalloc(sizeof(*init), GFP_KERNEL); + init = kzalloc_obj(*init, GFP_KERNEL); if (!init) goto free; diff --git a/drivers/clk/ti/gate.c b/drivers/clk/ti/gate.c index a9febd6356b8..73986d78492a 100644 --- a/drivers/clk/ti/gate.c +++ b/drivers/clk/ti/gate.c @@ -95,7 +95,7 @@ static struct clk *_register_gate(struct device_node *node, const char *name, struct clk_hw_omap *clk_hw; struct clk *clk; - clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); + clk_hw = kzalloc_obj(*clk_hw, GFP_KERNEL); if (!clk_hw) return ERR_PTR(-ENOMEM); @@ -169,7 +169,7 @@ _of_ti_composite_gate_clk_setup(struct device_node *node, { struct clk_hw_omap *gate; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return; diff --git a/drivers/clk/ti/interface.c b/drivers/clk/ti/interface.c index 3eb35c87c0ed..999e230d7414 100644 --- a/drivers/clk/ti/interface.c +++ b/drivers/clk/ti/interface.c @@ -34,7 +34,7 @@ static struct clk *_register_interface(struct device_node *node, struct clk_hw_omap *clk_hw; struct clk *clk; - clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); + clk_hw = kzalloc_obj(*clk_hw, GFP_KERNEL); if (!clk_hw) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/ti/mux.c b/drivers/clk/ti/mux.c index d6d247ff2be5..3911e43a6716 100644 --- a/drivers/clk/ti/mux.c +++ b/drivers/clk/ti/mux.c @@ -129,7 +129,7 @@ static struct clk *_register_mux(struct device_node *node, const char *name, struct clk_init_data init; /* allocate the mux */ - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return ERR_PTR(-ENOMEM); @@ -227,7 +227,7 @@ struct clk_hw *ti_clk_build_component_mux(struct ti_clk_mux *setup) if (!setup) return NULL; - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return ERR_PTR(-ENOMEM); @@ -253,7 +253,7 @@ static void __init of_ti_composite_mux_clk_setup(struct device_node *node) struct clk_omap_mux *mux; unsigned int num_parents; - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return; diff --git a/drivers/clk/ux500/clk-prcc.c b/drivers/clk/ux500/clk-prcc.c index b85ee0930369..5639474557fe 100644 --- a/drivers/clk/ux500/clk-prcc.c +++ b/drivers/clk/ux500/clk-prcc.c @@ -106,7 +106,7 @@ static struct clk *clk_reg_prcc(const char *name, return ERR_PTR(-EINVAL); } - clk = kzalloc(sizeof(*clk), GFP_KERNEL); + clk = kzalloc_obj(*clk, GFP_KERNEL); if (!clk) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/ux500/clk-prcmu.c b/drivers/clk/ux500/clk-prcmu.c index f775e18acd46..95efbc4f84a7 100644 --- a/drivers/clk/ux500/clk-prcmu.c +++ b/drivers/clk/ux500/clk-prcmu.c @@ -209,7 +209,7 @@ static struct clk_hw *clk_reg_prcmu(const char *name, return ERR_PTR(-EINVAL); } - clk = kzalloc(sizeof(*clk), GFP_KERNEL); + clk = kzalloc_obj(*clk, GFP_KERNEL); if (!clk) return ERR_PTR(-ENOMEM); @@ -376,7 +376,7 @@ struct clk_hw *clk_reg_prcmu_clkout(const char *name, return ERR_PTR(-EINVAL); } - clk = kzalloc(sizeof(*clk), GFP_KERNEL); + clk = kzalloc_obj(*clk, GFP_KERNEL); if (!clk) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/ux500/u8500_of_clk.c b/drivers/clk/ux500/u8500_of_clk.c index 8e2f6c65db2a..42c1df2382ee 100644 --- a/drivers/clk/ux500/u8500_of_clk.c +++ b/drivers/clk/ux500/u8500_of_clk.c @@ -137,7 +137,7 @@ static void u8500_clk_init(struct device_node *np) * base addresses properly and pass to the reset controller init * function later on. */ - rstc = kzalloc(sizeof(*rstc), GFP_KERNEL); + rstc = kzalloc_obj(*rstc, GFP_KERNEL); if (!rstc) return; diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c index 86ca04ad9fab..d95d66cd5b6a 100644 --- a/drivers/clk/versatile/clk-icst.c +++ b/drivers/clk/versatile/clk-icst.c @@ -363,7 +363,7 @@ struct clk *icst_clk_setup(struct device *dev, struct clk_init_data init; struct icst_params *pclone; - icst = kzalloc(sizeof(*icst), GFP_KERNEL); + icst = kzalloc_obj(*icst, GFP_KERNEL); if (!icst) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c index 033d4f78edc8..5f83760b68d4 100644 --- a/drivers/clk/versatile/clk-sp810.c +++ b/drivers/clk/versatile/clk-sp810.c @@ -82,7 +82,7 @@ static struct clk *clk_sp810_timerclken_of_get(struct of_phandle_args *clkspec, static void __init clk_sp810_of_setup(struct device_node *node) { - struct clk_sp810 *sp810 = kzalloc(sizeof(*sp810), GFP_KERNEL); + struct clk_sp810 *sp810 = kzalloc_obj(*sp810, GFP_KERNEL); const char *parent_names[2]; int num = ARRAY_SIZE(parent_names); char name[12]; diff --git a/drivers/clk/visconti/pll.c b/drivers/clk/visconti/pll.c index 681721d85032..7494a24134de 100644 --- a/drivers/clk/visconti/pll.c +++ b/drivers/clk/visconti/pll.c @@ -255,7 +255,7 @@ static struct clk_hw *visconti_register_pll(struct visconti_pll_provider *ctx, size_t len; int ret; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); @@ -330,7 +330,7 @@ struct visconti_pll_provider * __init visconti_init_pll(struct device_node *np, struct visconti_pll_provider *ctx; int i; - ctx = kzalloc(struct_size(ctx, clk_data.hws, nr_plls), GFP_KERNEL); + ctx = kzalloc_flex(*ctx, clk_data.hws, nr_plls, GFP_KERNEL); if (!ctx) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c index c28d3dacf0fb..4a5f2b6267c0 100644 --- a/drivers/clk/zynq/clkc.c +++ b/drivers/clk/zynq/clkc.c @@ -112,10 +112,10 @@ static void __init zynq_clk_register_fclk(enum zynq_clk fclk, spinlock_t *fclk_gate_lock; void __iomem *fclk_gate_reg = fclk_ctrl_reg + 8; - fclk_lock = kmalloc(sizeof(*fclk_lock), GFP_KERNEL); + fclk_lock = kmalloc_obj(*fclk_lock, GFP_KERNEL); if (!fclk_lock) goto err; - fclk_gate_lock = kmalloc(sizeof(*fclk_gate_lock), GFP_KERNEL); + fclk_gate_lock = kmalloc_obj(*fclk_gate_lock, GFP_KERNEL); if (!fclk_gate_lock) goto err_fclk_gate_lock; spin_lock_init(fclk_lock); @@ -180,7 +180,7 @@ static void __init zynq_clk_register_periph_clk(enum zynq_clk clk0, char *div_name; spinlock_t *lock; - lock = kmalloc(sizeof(*lock), GFP_KERNEL); + lock = kmalloc_obj(*lock, GFP_KERNEL); if (!lock) goto err; spin_lock_init(lock); diff --git a/drivers/clk/zynq/pll.c b/drivers/clk/zynq/pll.c index 5eca1c14981a..0c411ad86575 100644 --- a/drivers/clk/zynq/pll.c +++ b/drivers/clk/zynq/pll.c @@ -200,7 +200,7 @@ struct clk *clk_register_zynq_pll(const char *name, const char *parent, .flags = 0 }; - pll = kmalloc(sizeof(*pll), GFP_KERNEL); + pll = kmalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/zynqmp/clk-gate-zynqmp.c b/drivers/clk/zynqmp/clk-gate-zynqmp.c index b89e55737198..2e36f14d0a52 100644 --- a/drivers/clk/zynqmp/clk-gate-zynqmp.c +++ b/drivers/clk/zynqmp/clk-gate-zynqmp.c @@ -115,7 +115,7 @@ struct clk_hw *zynqmp_clk_register_gate(const char *name, u32 clk_id, struct clk_init_data init; /* allocate the gate */ - gate = kzalloc(sizeof(*gate), GFP_KERNEL); + gate = kzalloc_obj(*gate, GFP_KERNEL); if (!gate) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/zynqmp/clk-mux-zynqmp.c b/drivers/clk/zynqmp/clk-mux-zynqmp.c index 9b5d3050b742..f8d67adfd258 100644 --- a/drivers/clk/zynqmp/clk-mux-zynqmp.c +++ b/drivers/clk/zynqmp/clk-mux-zynqmp.c @@ -138,7 +138,7 @@ struct clk_hw *zynqmp_clk_register_mux(const char *name, u32 clk_id, struct clk_init_data init; int ret; - mux = kzalloc(sizeof(*mux), GFP_KERNEL); + mux = kzalloc_obj(*mux, GFP_KERNEL); if (!mux) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c index a91d98e238c2..c71401b3aa1f 100644 --- a/drivers/clk/zynqmp/clkc.c +++ b/drivers/clk/zynqmp/clkc.c @@ -759,12 +759,11 @@ static int zynqmp_clk_setup(struct device_node *np) if (ret) return ret; - zynqmp_data = kzalloc(struct_size(zynqmp_data, hws, clock_max_idx), - GFP_KERNEL); + zynqmp_data = kzalloc_flex(*zynqmp_data, hws, clock_max_idx, GFP_KERNEL); if (!zynqmp_data) return -ENOMEM; - clock = kcalloc(clock_max_idx, sizeof(*clock), GFP_KERNEL); + clock = kzalloc_objs(*clock, clock_max_idx, GFP_KERNEL); if (!clock) { kfree(zynqmp_data); return -ENOMEM; diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c index 984e577ea671..3c147ba7dbcc 100644 --- a/drivers/clk/zynqmp/divider.c +++ b/drivers/clk/zynqmp/divider.c @@ -284,7 +284,7 @@ struct clk_hw *zynqmp_clk_register_divider(const char *name, int ret; /* allocate the divider */ - div = kzalloc(sizeof(*div), GFP_KERNEL); + div = kzalloc_obj(*div, GFP_KERNEL); if (!div) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/zynqmp/pll.c b/drivers/clk/zynqmp/pll.c index 6bc2c3934f56..1cd5e0493e98 100644 --- a/drivers/clk/zynqmp/pll.c +++ b/drivers/clk/zynqmp/pll.c @@ -326,7 +326,7 @@ struct clk_hw *zynqmp_clk_register_pll(const char *name, u32 clk_id, init.parent_names = parents; init.num_parents = 1; - pll = kzalloc(sizeof(*pll), GFP_KERNEL); + pll = kzalloc_obj(*pll, GFP_KERNEL); if (!pll) return ERR_PTR(-ENOMEM); |
