mtd: rawnand: qcom: Early structure initialization
authorMiquel Raynal <miquel.raynal@bootlin.com>
Sun, 16 Jul 2023 14:46:11 +0000 (16:46 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 28 Jul 2023 12:32:28 +0000 (14:32 +0200)
commite260efea80e9cab8ad9dea1a03db11225df720f3
treece603305989aa54b57d8ab32edd22af9c8d5a56b
parent548b7509d92d1349b01ed2293dcdde88f3d7a907
mtd: rawnand: qcom: Early structure initialization

Instead of allocating a structure on the stack with random data and then
expect the callee to perform the initialization (which is, in general,
error prone), prefer zeroing the structure explicitly at allocation and
provide the already zeroed area, so no explicit memset operation is
needed. It is probably safer to do so, so we limit the timeframe when
dirty data could actually be accessed by mistake.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/linux-mtd/20230716144612.32132-8-miquel.raynal@bootlin.com
drivers/mtd/nand/raw/qcom_nandc.c