diff options
author | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-12-15 09:24:32 +0100 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2019-02-05 15:39:38 +0100 |
commit | 6c721acdd558e46c5b053302ff526f07e51f5c7f (patch) | |
tree | 48bc80cbd7c8cb77b3a47e3c6f5f2642fe161b2f /drivers/mtd | |
parent | f385ebf074d1371960c55184b727a118a9e3cfb9 (diff) | |
download | linux-6c721acdd558e46c5b053302ff526f07e51f5c7f.tar.gz linux-6c721acdd558e46c5b053302ff526f07e51f5c7f.tar.bz2 linux-6c721acdd558e46c5b053302ff526f07e51f5c7f.zip |
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>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/raw/sunxi_nand.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c index f7e4f3f77028..7c484537e170 100644 --- a/drivers/mtd/nand/raw/sunxi_nand.c +++ b/drivers/mtd/nand/raw/sunxi_nand.c @@ -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"); |