mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
f385ebf074
commit
6c721acdd5
|
@ -1871,9 +1871,7 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sunxi_nand = devm_kzalloc(dev,
|
sunxi_nand = devm_kzalloc(dev, struct_size(sunxi_nand, sels, nsels),
|
||||||
sizeof(*sunxi_nand) +
|
|
||||||
(nsels * sizeof(struct sunxi_nand_chip_sel)),
|
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!sunxi_nand) {
|
if (!sunxi_nand) {
|
||||||
dev_err(dev, "could not allocate chip\n");
|
dev_err(dev, "could not allocate chip\n");
|
||||||
|
|
Loading…
Reference in New Issue