From: Martin Blumenstingl Date: Thu, 11 Apr 2019 22:00:53 +0000 (+0200) Subject: mtd: rawnand: meson: use struct_size macro X-Git-Tag: v5.15~6384^2~30^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f73f240a4ffe49f596314312f1d3731d011e195;p=platform%2Fkernel%2Flinux-starfive.git 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 Tested-by:Liang Yang Acked-by: Liang Yang Signed-off-by: Miquel Raynal --- diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index cb0b03e..c1a6af5 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -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;