1
0
Fork 0

mtd: rawnand: sunxi: Use struct_size()

Use struct_size() to calculate sunxi_nand object size.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
hifive-unleashed-5.1
Boris Brezillon 2018-12-15 09:24:32 +01:00 committed by Miquel Raynal
parent f385ebf074
commit 6c721acdd5
1 changed files with 1 additions and 3 deletions

View File

@ -1871,9 +1871,7 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
return -EINVAL;
}
sunxi_nand = devm_kzalloc(dev,
sizeof(*sunxi_nand) +
(nsels * sizeof(struct sunxi_nand_chip_sel)),
sunxi_nand = devm_kzalloc(dev, struct_size(sunxi_nand, sels, nsels),
GFP_KERNEL);
if (!sunxi_nand) {
dev_err(dev, "could not allocate chip\n");