Skip to content

Commit a0b1b20

Browse files
thierryredingdavem330
authored andcommitted
net: stmmac: tegra: Properly allocate clock bulk data
The clock data is an array of struct clk_bulk_data, so make sure to allocate enough memory. Fixes: d8ca113 ("net: stmmac: tegra: Add MGBE support") Signed-off-by: Thierry Reding <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 56c6be3 commit a0b1b20

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
234234
res.addr = mgbe->regs;
235235
res.irq = irq;
236236

237-
mgbe->clks = devm_kzalloc(&pdev->dev, sizeof(*mgbe->clks), GFP_KERNEL);
237+
mgbe->clks = devm_kcalloc(&pdev->dev, ARRAY_SIZE(mgbe_clks),
238+
sizeof(*mgbe->clks), GFP_KERNEL);
238239
if (!mgbe->clks)
239240
return -ENOMEM;
240241

0 commit comments

Comments
 (0)