diff options
Diffstat (limited to 'drivers/clk')
24 files changed, 50 insertions, 55 deletions
diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c index 77e276d61702..f225ad29b110 100644 --- a/drivers/clk/bcm/clk-bcm2835-aux.c +++ b/drivers/clk/bcm/clk-bcm2835-aux.c | |||
| @@ -40,8 +40,10 @@ static int bcm2835_aux_clk_probe(struct platform_device *pdev) | |||
| 40 | if (IS_ERR(reg)) | 40 | if (IS_ERR(reg)) |
| 41 | return PTR_ERR(reg); | 41 | return PTR_ERR(reg); |
| 42 | 42 | ||
| 43 | onecell = devm_kmalloc(dev, sizeof(*onecell) + sizeof(*onecell->hws) * | 43 | onecell = devm_kmalloc(dev, |
| 44 | BCM2835_AUX_CLOCK_COUNT, GFP_KERNEL); | 44 | struct_size(onecell, hws, |
| 45 | BCM2835_AUX_CLOCK_COUNT), | ||
| 46 | GFP_KERNEL); | ||
| 45 | if (!onecell) | 47 | if (!onecell) |
| 46 | return -ENOMEM; | 48 | return -ENOMEM; |
| 47 | onecell->num = BCM2835_AUX_CLOCK_COUNT; | 49 | onecell->num = BCM2835_AUX_CLOCK_COUNT; |
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index fa0d5c8611a0..6d4e69edfb36 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c | |||
| @@ -2147,8 +2147,8 @@ static int bcm2835_clk_probe(struct platform_device *pdev) | |||
| 2147 | size_t i; | 2147 | size_t i; |
| 2148 | int ret; | 2148 | int ret; |
| 2149 | 2149 | ||
| 2150 | cprman = devm_kzalloc(dev, sizeof(*cprman) + | 2150 | cprman = devm_kzalloc(dev, |
| 2151 | sizeof(*cprman->onecell.hws) * asize, | 2151 | struct_size(cprman, onecell.hws, asize), |
| 2152 | GFP_KERNEL); | 2152 | GFP_KERNEL); |
| 2153 | if (!cprman) | 2153 | if (!cprman) |
| 2154 | return -ENOMEM; | 2154 | return -ENOMEM; |
diff --git a/drivers/clk/bcm/clk-iproc-asiu.c b/drivers/clk/bcm/clk-iproc-asiu.c index 4360e481368b..6fb8af506777 100644 --- a/drivers/clk/bcm/clk-iproc-asiu.c +++ b/drivers/clk/bcm/clk-iproc-asiu.c | |||
| @@ -197,8 +197,8 @@ void __init iproc_asiu_setup(struct device_node *node, | |||
| 197 | if (WARN_ON(!asiu)) | 197 | if (WARN_ON(!asiu)) |
| 198 | return; | 198 | return; |
| 199 | 199 | ||
| 200 | asiu->clk_data = kzalloc(sizeof(*asiu->clk_data->hws) * num_clks + | 200 | asiu->clk_data = kzalloc(struct_size(asiu->clk_data, hws, num_clks), |
| 201 | sizeof(*asiu->clk_data), GFP_KERNEL); | 201 | GFP_KERNEL); |
| 202 | if (WARN_ON(!asiu->clk_data)) | 202 | if (WARN_ON(!asiu->clk_data)) |
| 203 | goto err_clks; | 203 | goto err_clks; |
| 204 | asiu->clk_data->num = num_clks; | 204 | asiu->clk_data->num = num_clks; |
diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c index 43a58ae5a89d..274441e2ddb2 100644 --- a/drivers/clk/bcm/clk-iproc-pll.c +++ b/drivers/clk/bcm/clk-iproc-pll.c | |||
| @@ -744,8 +744,7 @@ void iproc_pll_clk_setup(struct device_node *node, | |||
| 744 | if (WARN_ON(!pll)) | 744 | if (WARN_ON(!pll)) |
| 745 | return; | 745 | return; |
| 746 | 746 | ||
| 747 | clk_data = kzalloc(sizeof(*clk_data->hws) * num_clks + | 747 | clk_data = kzalloc(struct_size(clk_data, hws, num_clks), GFP_KERNEL); |
| 748 | sizeof(*clk_data), GFP_KERNEL); | ||
| 749 | if (WARN_ON(!clk_data)) | 748 | if (WARN_ON(!clk_data)) |
| 750 | goto err_clk_data; | 749 | goto err_clk_data; |
| 751 | clk_data->num = num_clks; | 750 | clk_data->num = num_clks; |
diff --git a/drivers/clk/berlin/bg2.c b/drivers/clk/berlin/bg2.c index e7331ace0337..45fb888bf0a0 100644 --- a/drivers/clk/berlin/bg2.c +++ b/drivers/clk/berlin/bg2.c | |||
| @@ -509,8 +509,7 @@ static void __init berlin2_clock_setup(struct device_node *np) | |||
| 509 | u8 avpll_flags = 0; | 509 | u8 avpll_flags = 0; |
| 510 | int n, ret; | 510 | int n, ret; |
| 511 | 511 | ||
| 512 | clk_data = kzalloc(sizeof(*clk_data) + | 512 | clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); |
| 513 | sizeof(*clk_data->hws) * MAX_CLKS, GFP_KERNEL); | ||
| 514 | if (!clk_data) | 513 | if (!clk_data) |
| 515 | return; | 514 | return; |
| 516 | clk_data->num = MAX_CLKS; | 515 | clk_data->num = MAX_CLKS; |
diff --git a/drivers/clk/berlin/bg2q.c b/drivers/clk/berlin/bg2q.c index 67c270b143f7..db7364e15c8b 100644 --- a/drivers/clk/berlin/bg2q.c +++ b/drivers/clk/berlin/bg2q.c | |||
| @@ -295,8 +295,7 @@ static void __init berlin2q_clock_setup(struct device_node *np) | |||
| 295 | struct clk_hw **hws; | 295 | struct clk_hw **hws; |
| 296 | int n, ret; | 296 | int n, ret; |
| 297 | 297 | ||
| 298 | clk_data = kzalloc(sizeof(*clk_data) + | 298 | clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); |
| 299 | sizeof(*clk_data->hws) * MAX_CLKS, GFP_KERNEL); | ||
| 300 | if (!clk_data) | 299 | if (!clk_data) |
| 301 | return; | 300 | return; |
| 302 | clk_data->num = MAX_CLKS; | 301 | clk_data->num = MAX_CLKS; |
diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c index bf0582cbbf38..44b544157121 100644 --- a/drivers/clk/clk-asm9260.c +++ b/drivers/clk/clk-asm9260.c | |||
| @@ -273,8 +273,7 @@ static void __init asm9260_acc_init(struct device_node *np) | |||
| 273 | int n; | 273 | int n; |
| 274 | u32 accuracy = 0; | 274 | u32 accuracy = 0; |
| 275 | 275 | ||
| 276 | clk_data = kzalloc(sizeof(*clk_data) + | 276 | clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); |
| 277 | sizeof(*clk_data->hws) * MAX_CLKS, GFP_KERNEL); | ||
| 278 | if (!clk_data) | 277 | if (!clk_data) |
| 279 | return; | 278 | return; |
| 280 | clk_data->num = MAX_CLKS; | 279 | clk_data->num = MAX_CLKS; |
diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c index 5eb50c31e455..7abe4232d282 100644 --- a/drivers/clk/clk-aspeed.c +++ b/drivers/clk/clk-aspeed.c | |||
| @@ -627,9 +627,9 @@ static void __init aspeed_cc_init(struct device_node *np) | |||
| 627 | if (!scu_base) | 627 | if (!scu_base) |
| 628 | return; | 628 | return; |
| 629 | 629 | ||
| 630 | aspeed_clk_data = kzalloc(sizeof(*aspeed_clk_data) + | 630 | aspeed_clk_data = kzalloc(struct_size(aspeed_clk_data, hws, |
| 631 | sizeof(*aspeed_clk_data->hws) * ASPEED_NUM_CLKS, | 631 | ASPEED_NUM_CLKS), |
| 632 | GFP_KERNEL); | 632 | GFP_KERNEL); |
| 633 | if (!aspeed_clk_data) | 633 | if (!aspeed_clk_data) |
| 634 | return; | 634 | return; |
| 635 | 635 | ||
diff --git a/drivers/clk/clk-clps711x.c b/drivers/clk/clk-clps711x.c index 9193f64561f6..2c04396402ab 100644 --- a/drivers/clk/clk-clps711x.c +++ b/drivers/clk/clk-clps711x.c | |||
| @@ -54,9 +54,9 @@ static struct clps711x_clk * __init _clps711x_clk_init(void __iomem *base, | |||
| 54 | if (!base) | 54 | if (!base) |
| 55 | return ERR_PTR(-ENOMEM); | 55 | return ERR_PTR(-ENOMEM); |
| 56 | 56 | ||
| 57 | clps711x_clk = kzalloc(sizeof(*clps711x_clk) + | 57 | clps711x_clk = kzalloc(struct_size(clps711x_clk, clk_data.hws, |
| 58 | sizeof(*clps711x_clk->clk_data.hws) * CLPS711X_CLK_MAX, | 58 | CLPS711X_CLK_MAX), |
| 59 | GFP_KERNEL); | 59 | GFP_KERNEL); |
| 60 | if (!clps711x_clk) | 60 | if (!clps711x_clk) |
| 61 | return ERR_PTR(-ENOMEM); | 61 | return ERR_PTR(-ENOMEM); |
| 62 | 62 | ||
diff --git a/drivers/clk/clk-efm32gg.c b/drivers/clk/clk-efm32gg.c index f674778fb3ac..f37cf08ff7aa 100644 --- a/drivers/clk/clk-efm32gg.c +++ b/drivers/clk/clk-efm32gg.c | |||
| @@ -25,8 +25,8 @@ static void __init efm32gg_cmu_init(struct device_node *np) | |||
| 25 | void __iomem *base; | 25 | void __iomem *base; |
| 26 | struct clk_hw **hws; | 26 | struct clk_hw **hws; |
| 27 | 27 | ||
| 28 | clk_data = kzalloc(sizeof(*clk_data) + | 28 | clk_data = kzalloc(struct_size(clk_data, hws, CMU_MAX_CLKS), |
| 29 | sizeof(*clk_data->hws) * CMU_MAX_CLKS, GFP_KERNEL); | 29 | GFP_KERNEL); |
| 30 | 30 | ||
| 31 | if (!clk_data) | 31 | if (!clk_data) |
| 32 | return; | 32 | return; |
diff --git a/drivers/clk/clk-gemini.c b/drivers/clk/clk-gemini.c index 5e66e6c0205e..b51069e794ff 100644 --- a/drivers/clk/clk-gemini.c +++ b/drivers/clk/clk-gemini.c | |||
| @@ -399,9 +399,9 @@ static void __init gemini_cc_init(struct device_node *np) | |||
| 399 | int ret; | 399 | int ret; |
| 400 | int i; | 400 | int i; |
| 401 | 401 | ||
| 402 | gemini_clk_data = kzalloc(sizeof(*gemini_clk_data) + | 402 | gemini_clk_data = kzalloc(struct_size(gemini_clk_data, hws, |
| 403 | sizeof(*gemini_clk_data->hws) * GEMINI_NUM_CLKS, | 403 | GEMINI_NUM_CLKS), |
| 404 | GFP_KERNEL); | 404 | GFP_KERNEL); |
| 405 | if (!gemini_clk_data) | 405 | if (!gemini_clk_data) |
| 406 | return; | 406 | return; |
| 407 | 407 | ||
diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c index fbaa84a33c46..d44e0eea31ec 100644 --- a/drivers/clk/clk-s2mps11.c +++ b/drivers/clk/clk-s2mps11.c | |||
| @@ -147,8 +147,8 @@ static int s2mps11_clk_probe(struct platform_device *pdev) | |||
| 147 | if (!s2mps11_clks) | 147 | if (!s2mps11_clks) |
| 148 | return -ENOMEM; | 148 | return -ENOMEM; |
| 149 | 149 | ||
| 150 | clk_data = devm_kzalloc(&pdev->dev, sizeof(*clk_data) + | 150 | clk_data = devm_kzalloc(&pdev->dev, |
| 151 | sizeof(*clk_data->hws) * S2MPS11_CLKS_NUM, | 151 | struct_size(clk_data, hws, S2MPS11_CLKS_NUM), |
| 152 | GFP_KERNEL); | 152 | GFP_KERNEL); |
| 153 | if (!clk_data) | 153 | if (!clk_data) |
| 154 | return -ENOMEM; | 154 | return -ENOMEM; |
diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c index 488c21376b55..bb2a6f2f5516 100644 --- a/drivers/clk/clk-scmi.c +++ b/drivers/clk/clk-scmi.c | |||
| @@ -137,8 +137,8 @@ static int scmi_clocks_probe(struct scmi_device *sdev) | |||
| 137 | return -EINVAL; | 137 | return -EINVAL; |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | clk_data = devm_kzalloc(dev, sizeof(*clk_data) + | 140 | clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, count), |
| 141 | sizeof(*clk_data->hws) * count, GFP_KERNEL); | 141 | GFP_KERNEL); |
| 142 | if (!clk_data) | 142 | if (!clk_data) |
| 143 | return -ENOMEM; | 143 | return -ENOMEM; |
| 144 | 144 | ||
diff --git a/drivers/clk/clk-stm32h7.c b/drivers/clk/clk-stm32h7.c index db2b162c0d4c..d3271eca3779 100644 --- a/drivers/clk/clk-stm32h7.c +++ b/drivers/clk/clk-stm32h7.c | |||
| @@ -1201,9 +1201,8 @@ static void __init stm32h7_rcc_init(struct device_node *np) | |||
| 1201 | const char *hse_clk, *lse_clk, *i2s_clk; | 1201 | const char *hse_clk, *lse_clk, *i2s_clk; |
| 1202 | struct regmap *pdrm; | 1202 | struct regmap *pdrm; |
| 1203 | 1203 | ||
| 1204 | clk_data = kzalloc(sizeof(*clk_data) + | 1204 | clk_data = kzalloc(struct_size(clk_data, hws, STM32H7_MAX_CLKS), |
| 1205 | sizeof(*clk_data->hws) * STM32H7_MAX_CLKS, | 1205 | GFP_KERNEL); |
| 1206 | GFP_KERNEL); | ||
| 1207 | if (!clk_data) | 1206 | if (!clk_data) |
| 1208 | return; | 1207 | return; |
| 1209 | 1208 | ||
diff --git a/drivers/clk/clk-stm32mp1.c b/drivers/clk/clk-stm32mp1.c index edd3cf451401..83e8cd81674f 100644 --- a/drivers/clk/clk-stm32mp1.c +++ b/drivers/clk/clk-stm32mp1.c | |||
| @@ -2060,9 +2060,8 @@ static int stm32_rcc_init(struct device_node *np, | |||
| 2060 | 2060 | ||
| 2061 | max_binding = data->maxbinding; | 2061 | max_binding = data->maxbinding; |
| 2062 | 2062 | ||
| 2063 | clk_data = kzalloc(sizeof(*clk_data) + | 2063 | clk_data = kzalloc(struct_size(clk_data, hws, max_binding), |
| 2064 | sizeof(*clk_data->hws) * max_binding, | 2064 | GFP_KERNEL); |
| 2065 | GFP_KERNEL); | ||
| 2066 | if (!clk_data) | 2065 | if (!clk_data) |
| 2067 | return -ENOMEM; | 2066 | return -ENOMEM; |
| 2068 | 2067 | ||
diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c index c971111d2601..aae62a5b8734 100644 --- a/drivers/clk/davinci/da8xx-cfgchip.c +++ b/drivers/clk/davinci/da8xx-cfgchip.c | |||
| @@ -650,8 +650,8 @@ static int of_da8xx_usb_phy_clk_init(struct device *dev, struct regmap *regmap) | |||
| 650 | struct da8xx_usb0_clk48 *usb0; | 650 | struct da8xx_usb0_clk48 *usb0; |
| 651 | struct da8xx_usb1_clk48 *usb1; | 651 | struct da8xx_usb1_clk48 *usb1; |
| 652 | 652 | ||
| 653 | clk_data = devm_kzalloc(dev, sizeof(*clk_data) + 2 * | 653 | clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, 2), |
| 654 | sizeof(*clk_data->hws), GFP_KERNEL); | 654 | GFP_KERNEL); |
| 655 | if (!clk_data) | 655 | if (!clk_data) |
| 656 | return -ENOMEM; | 656 | return -ENOMEM; |
| 657 | 657 | ||
diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c index 87213ea7fc84..6860bd5a37c5 100644 --- a/drivers/clk/mvebu/armada-37xx-periph.c +++ b/drivers/clk/mvebu/armada-37xx-periph.c | |||
| @@ -667,9 +667,10 @@ static int armada_3700_periph_clock_probe(struct platform_device *pdev) | |||
| 667 | if (!driver_data) | 667 | if (!driver_data) |
| 668 | return -ENOMEM; | 668 | return -ENOMEM; |
| 669 | 669 | ||
| 670 | driver_data->hw_data = devm_kzalloc(dev, sizeof(*driver_data->hw_data) + | 670 | driver_data->hw_data = devm_kzalloc(dev, |
| 671 | sizeof(*driver_data->hw_data->hws) * num_periph, | 671 | struct_size(driver_data->hw_data, |
| 672 | GFP_KERNEL); | 672 | hws, num_periph), |
| 673 | GFP_KERNEL); | ||
| 673 | if (!driver_data->hw_data) | 674 | if (!driver_data->hw_data) |
| 674 | return -ENOMEM; | 675 | return -ENOMEM; |
| 675 | driver_data->hw_data->num = num_periph; | 676 | driver_data->hw_data->num = num_periph; |
diff --git a/drivers/clk/mvebu/armada-37xx-tbg.c b/drivers/clk/mvebu/armada-37xx-tbg.c index aa80db11f543..7ff041f73b55 100644 --- a/drivers/clk/mvebu/armada-37xx-tbg.c +++ b/drivers/clk/mvebu/armada-37xx-tbg.c | |||
| @@ -91,8 +91,8 @@ static int armada_3700_tbg_clock_probe(struct platform_device *pdev) | |||
| 91 | void __iomem *reg; | 91 | void __iomem *reg; |
| 92 | int i, ret; | 92 | int i, ret; |
| 93 | 93 | ||
| 94 | hw_tbg_data = devm_kzalloc(&pdev->dev, sizeof(*hw_tbg_data) | 94 | hw_tbg_data = devm_kzalloc(&pdev->dev, |
| 95 | + sizeof(*hw_tbg_data->hws) * NUM_TBG, | 95 | struct_size(hw_tbg_data, hws, NUM_TBG), |
| 96 | GFP_KERNEL); | 96 | GFP_KERNEL); |
| 97 | if (!hw_tbg_data) | 97 | if (!hw_tbg_data) |
| 98 | return -ENOMEM; | 98 | return -ENOMEM; |
diff --git a/drivers/clk/qcom/clk-spmi-pmic-div.c b/drivers/clk/qcom/clk-spmi-pmic-div.c index 8672ab84746f..c90dfdd6c147 100644 --- a/drivers/clk/qcom/clk-spmi-pmic-div.c +++ b/drivers/clk/qcom/clk-spmi-pmic-div.c | |||
| @@ -239,8 +239,7 @@ static int spmi_pmic_clkdiv_probe(struct platform_device *pdev) | |||
| 239 | if (!nclks) | 239 | if (!nclks) |
| 240 | return -EINVAL; | 240 | return -EINVAL; |
| 241 | 241 | ||
| 242 | cc = devm_kzalloc(dev, sizeof(*cc) + sizeof(*cc->clks) * nclks, | 242 | cc = devm_kzalloc(dev, struct_size(cc, clks, nclks), GFP_KERNEL); |
| 243 | GFP_KERNEL); | ||
| 244 | if (!cc) | 243 | if (!cc) |
| 245 | return -ENOMEM; | 244 | return -ENOMEM; |
| 246 | cc->nclks = nclks; | 245 | cc->nclks = nclks; |
diff --git a/drivers/clk/samsung/clk-exynos-audss.c b/drivers/clk/samsung/clk-exynos-audss.c index b4b057c7301c..f659c5cbf1d5 100644 --- a/drivers/clk/samsung/clk-exynos-audss.c +++ b/drivers/clk/samsung/clk-exynos-audss.c | |||
| @@ -149,8 +149,8 @@ static int exynos_audss_clk_probe(struct platform_device *pdev) | |||
| 149 | epll = ERR_PTR(-ENODEV); | 149 | epll = ERR_PTR(-ENODEV); |
| 150 | 150 | ||
| 151 | clk_data = devm_kzalloc(dev, | 151 | clk_data = devm_kzalloc(dev, |
| 152 | sizeof(*clk_data) + | 152 | struct_size(clk_data, hws, |
| 153 | sizeof(*clk_data->hws) * EXYNOS_AUDSS_MAX_CLKS, | 153 | EXYNOS_AUDSS_MAX_CLKS), |
| 154 | GFP_KERNEL); | 154 | GFP_KERNEL); |
| 155 | if (!clk_data) | 155 | if (!clk_data) |
| 156 | return -ENOMEM; | 156 | return -ENOMEM; |
diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c index f29fb5824005..9c95390d2d77 100644 --- a/drivers/clk/samsung/clk-exynos-clkout.c +++ b/drivers/clk/samsung/clk-exynos-clkout.c | |||
| @@ -61,8 +61,7 @@ static void __init exynos_clkout_init(struct device_node *node, u32 mux_mask) | |||
| 61 | int ret; | 61 | int ret; |
| 62 | int i; | 62 | int i; |
| 63 | 63 | ||
| 64 | clkout = kzalloc(sizeof(*clkout) + | 64 | clkout = kzalloc(struct_size(clkout, data.hws, EXYNOS_CLKOUT_NR_CLKS), |
| 65 | sizeof(*clkout->data.hws) * EXYNOS_CLKOUT_NR_CLKS, | ||
| 66 | GFP_KERNEL); | 65 | GFP_KERNEL); |
| 67 | if (!clkout) | 66 | if (!clkout) |
| 68 | return; | 67 | return; |
diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c index 5305ace514b2..162de44df099 100644 --- a/drivers/clk/samsung/clk-exynos5433.c +++ b/drivers/clk/samsung/clk-exynos5433.c | |||
| @@ -5505,8 +5505,8 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev) | |||
| 5505 | 5505 | ||
| 5506 | info = of_device_get_match_data(dev); | 5506 | info = of_device_get_match_data(dev); |
| 5507 | 5507 | ||
| 5508 | data = devm_kzalloc(dev, sizeof(*data) + | 5508 | data = devm_kzalloc(dev, |
| 5509 | sizeof(*data->ctx.clk_data.hws) * info->nr_clk_ids, | 5509 | struct_size(data, ctx.clk_data.hws, info->nr_clk_ids), |
| 5510 | GFP_KERNEL); | 5510 | GFP_KERNEL); |
| 5511 | if (!data) | 5511 | if (!data) |
| 5512 | return -ENOMEM; | 5512 | return -ENOMEM; |
diff --git a/drivers/clk/samsung/clk-s3c2410-dclk.c b/drivers/clk/samsung/clk-s3c2410-dclk.c index 077df3e539a7..66a904758761 100644 --- a/drivers/clk/samsung/clk-s3c2410-dclk.c +++ b/drivers/clk/samsung/clk-s3c2410-dclk.c | |||
| @@ -247,9 +247,10 @@ static int s3c24xx_dclk_probe(struct platform_device *pdev) | |||
| 247 | struct clk_hw **clk_table; | 247 | struct clk_hw **clk_table; |
| 248 | int ret, i; | 248 | int ret, i; |
| 249 | 249 | ||
| 250 | s3c24xx_dclk = devm_kzalloc(&pdev->dev, sizeof(*s3c24xx_dclk) + | 250 | s3c24xx_dclk = devm_kzalloc(&pdev->dev, |
| 251 | sizeof(*s3c24xx_dclk->clk_data.hws) * DCLK_MAX_CLKS, | 251 | struct_size(s3c24xx_dclk, clk_data.hws, |
| 252 | GFP_KERNEL); | 252 | DCLK_MAX_CLKS), |
| 253 | GFP_KERNEL); | ||
| 253 | if (!s3c24xx_dclk) | 254 | if (!s3c24xx_dclk) |
| 254 | return -ENOMEM; | 255 | return -ENOMEM; |
| 255 | 256 | ||
diff --git a/drivers/clk/samsung/clk-s5pv210-audss.c b/drivers/clk/samsung/clk-s5pv210-audss.c index b9641414ddc6..22b18e728b88 100644 --- a/drivers/clk/samsung/clk-s5pv210-audss.c +++ b/drivers/clk/samsung/clk-s5pv210-audss.c | |||
| @@ -81,8 +81,7 @@ static int s5pv210_audss_clk_probe(struct platform_device *pdev) | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | clk_data = devm_kzalloc(&pdev->dev, | 83 | clk_data = devm_kzalloc(&pdev->dev, |
| 84 | sizeof(*clk_data) + | 84 | struct_size(clk_data, hws, AUDSS_MAX_CLKS), |
| 85 | sizeof(*clk_data->hws) * AUDSS_MAX_CLKS, | ||
| 86 | GFP_KERNEL); | 85 | GFP_KERNEL); |
| 87 | 86 | ||
| 88 | if (!clk_data) | 87 | if (!clk_data) |
