Commit 6c721acd authored by Boris Brezillon's avatar Boris Brezillon Committed by Miquel Raynal
Browse files

mtd: rawnand: sunxi: Use struct_size()



Use struct_size() to calculate sunxi_nand object size.

Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent f385ebf0
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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");