mtd: rawnand: meson: use struct_size macro

Use the recently introduced struct_size macro instead of open-coding
it's logic.
No functional changes.

Signed-off-by: Martin Blumenstingl <[email protected]>
Tested-by:Liang Yang <[email protected]>
Acked-by: Liang Yang <[email protected]>
Signed-off-by: Miquel Raynal <[email protected]>
This commit is contained in:
Martin Blumenstingl 2019-04-12 00:00:53 +02:00 • committed by Miquel Raynal
commit 5f73f240a4

View file

@ -1242,8 +1242,7 @@ meson_nfc_nand_chip_init(struct device *dev,
return -EINVAL;
}
meson_chip = devm_kzalloc(dev,
sizeof(*meson_chip) + (nsels * sizeof(u8)),
meson_chip = devm_kzalloc(dev, struct_size(meson_chip, sels, nsels),
GFP_KERNEL);
if (!meson_chip)
return -ENOMEM;