treewide: Use struct_size() for devm_kmalloc() and friends
[linux-block.git] / drivers / clk / davinci / da8xx-cfgchip.c
index c971111d2601ca898f8df90360b90c18db63a12d..aae62a5b8734e859e76a16f995b05f43bf5f9b4a 100644 (file)
@@ -650,8 +650,8 @@ static int of_da8xx_usb_phy_clk_init(struct device *dev, struct regmap *regmap)
        struct da8xx_usb0_clk48 *usb0;
        struct da8xx_usb1_clk48 *usb1;
 
-       clk_data = devm_kzalloc(dev, sizeof(*clk_data) + 2 *
-                               sizeof(*clk_data->hws), GFP_KERNEL);
+       clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, 2),
+                               GFP_KERNEL);
        if (!clk_data)
                return -ENOMEM;